diff options
author | 2021-11-04 17:41:52 +0100 | |
---|---|---|
committer | 2021-11-04 17:41:52 +0100 | |
commit | 432ff3aaee8d45025f309436db541d0ec1b76485 (patch) | |
tree | 0d49c583f71f9972c6f5050540ac50e78992eaf2 /language-model | |
parent | fix(web): fix autocomplete prefix behavior (diff) | |
download | refinery-432ff3aaee8d45025f309436db541d0ec1b76485.tar.gz refinery-432ff3aaee8d45025f309436db541d0ec1b76485.tar.zst refinery-432ff3aaee8d45025f309436db541d0ec1b76485.zip |
fix(language): hide current implicit proposal
Content assist proposals should not display the object that is only
added to the model because the current context assist input refers to
it (e.g., an implicit node or variable that is only referenced in the
currently edited context).
Diffstat (limited to 'language-model')
-rw-r--r-- | language-model/src/main/java/tools/refinery/language/model/ProblemUtil.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/language-model/src/main/java/tools/refinery/language/model/ProblemUtil.java b/language-model/src/main/java/tools/refinery/language/model/ProblemUtil.java index b6b199f8..5f8641bf 100644 --- a/language-model/src/main/java/tools/refinery/language/model/ProblemUtil.java +++ b/language-model/src/main/java/tools/refinery/language/model/ProblemUtil.java | |||
@@ -12,6 +12,7 @@ import org.eclipse.emf.ecore.EObject; | |||
12 | import org.eclipse.emf.ecore.resource.Resource; | 12 | import org.eclipse.emf.ecore.resource.Resource; |
13 | 13 | ||
14 | import tools.refinery.language.model.problem.ClassDeclaration; | 14 | import tools.refinery.language.model.problem.ClassDeclaration; |
15 | import tools.refinery.language.model.problem.ImplicitVariable; | ||
15 | import tools.refinery.language.model.problem.Node; | 16 | import tools.refinery.language.model.problem.Node; |
16 | import tools.refinery.language.model.problem.Problem; | 17 | import tools.refinery.language.model.problem.Problem; |
17 | import tools.refinery.language.model.problem.ProblemPackage; | 18 | import tools.refinery.language.model.problem.ProblemPackage; |
@@ -33,6 +34,24 @@ public final class ProblemUtil { | |||
33 | public static boolean isSingletonVariable(Variable variable) { | 34 | public static boolean isSingletonVariable(Variable variable) { |
34 | return variable.eContainingFeature() == ProblemPackage.Literals.VARIABLE_OR_NODE_ARGUMENT__SINGLETON_VARIABLE; | 35 | return variable.eContainingFeature() == ProblemPackage.Literals.VARIABLE_OR_NODE_ARGUMENT__SINGLETON_VARIABLE; |
35 | } | 36 | } |
37 | |||
38 | public static boolean isImplicitVariable(Variable variable) { | ||
39 | return variable instanceof ImplicitVariable; | ||
40 | } | ||
41 | |||
42 | public static boolean isImplicitNode(Node node) { | ||
43 | return node.eContainingFeature() == ProblemPackage.Literals.PROBLEM__NODES; | ||
44 | } | ||
45 | |||
46 | public static boolean isImplicit(EObject eObject) { | ||
47 | if (eObject instanceof Node node) { | ||
48 | return isImplicitNode(node); | ||
49 | } else if (eObject instanceof Variable variable) { | ||
50 | return isImplicitVariable(variable); | ||
51 | } else { | ||
52 | return false; | ||
53 | } | ||
54 | } | ||
36 | 55 | ||
37 | public static boolean isUniqueNode(Node node) { | 56 | public static boolean isUniqueNode(Node node) { |
38 | var containingFeature = node.eContainingFeature(); | 57 | var containingFeature = node.eContainingFeature(); |