aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/language-ide/src
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2024-02-29 02:24:06 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2024-04-07 14:55:46 +0200
commit71fc54a96bf33dde7895ade0bd280887553125b0 (patch)
tree5b475f117ba9e999d9df8699d0bea77555e45bb5 /subprojects/language-ide/src
parentfeat(query): left join for data variables (diff)
downloadrefinery-71fc54a96bf33dde7895ade0bd280887553125b0.tar.gz
refinery-71fc54a96bf33dde7895ade0bd280887553125b0.tar.zst
refinery-71fc54a96bf33dde7895ade0bd280887553125b0.zip
refactor(language): assignment and cast expression
Also reorganizes operator names for easier future extension.
Diffstat (limited to 'subprojects/language-ide/src')
-rw-r--r--subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/ProblemCrossrefProposalProvider.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/ProblemCrossrefProposalProvider.java b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/ProblemCrossrefProposalProvider.java
index a09a475b..8b2542f3 100644
--- a/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/ProblemCrossrefProposalProvider.java
+++ b/subprojects/language-ide/src/main/java/tools/refinery/language/ide/contentassist/ProblemCrossrefProposalProvider.java
@@ -125,6 +125,13 @@ public class ProblemCrossrefProposalProvider extends IdeCrossrefProposalProvider
125 return oppositeShouldBeVisible(candidateReferenceDeclaration, context); 125 return oppositeShouldBeVisible(candidateReferenceDeclaration, context);
126 } 126 }
127 127
128 if (eReference.equals(ProblemPackage.Literals.VARIABLE_OR_NODE_EXPR__VARIABLE_OR_NODE)) {
129 var assignedVariable = getAssignedVariable(context.getCurrentModel());
130 if (assignedVariable != null && Objects.equals(assignedVariable, candidate.getEObjectOrProxy())) {
131 return false;
132 }
133 }
134
128 var builtinSymbolsOption = desugarer.getBuiltinSymbols(context.getRootModel()); 135 var builtinSymbolsOption = desugarer.getBuiltinSymbols(context.getRootModel());
129 if (builtinSymbolsOption.isEmpty()) { 136 if (builtinSymbolsOption.isEmpty()) {
130 return true; 137 return true;
@@ -135,6 +142,14 @@ public class ProblemCrossrefProposalProvider extends IdeCrossrefProposalProvider
135 candidateEObjectOrProxy); 142 candidateEObjectOrProxy);
136 } 143 }
137 144
145 private VariableOrNode getAssignedVariable(EObject context) {
146 var assignmentExpr = EcoreUtil2.getContainerOfType(context, AssignmentExpr.class);
147 if (assignmentExpr.getLeft() instanceof VariableOrNodeExpr variableOrNodeExpr) {
148 return variableOrNodeExpr.getVariableOrNode();
149 }
150 return null;
151 }
152
138 private boolean importedModuleShouldBeVisible(IEObjectDescription candidate, ContentAssistContext context) { 153 private boolean importedModuleShouldBeVisible(IEObjectDescription candidate, ContentAssistContext context) {
139 var moduleKind = candidate.getUserData(ProblemResourceDescriptionStrategy.MODULE_KIND); 154 var moduleKind = candidate.getUserData(ProblemResourceDescriptionStrategy.MODULE_KIND);
140 if (!ModuleKind.MODULE.getName().equals(moduleKind)) { 155 if (!ModuleKind.MODULE.getName().equals(moduleKind)) {