diff --git a/projectional-editor/src/commonMain/kotlin/org/modelix/editor/CellTemplate.kt b/projectional-editor/src/commonMain/kotlin/org/modelix/editor/CellTemplate.kt index 6eca2d57..2a749f3e 100644 --- a/projectional-editor/src/commonMain/kotlin/org/modelix/editor/CellTemplate.kt +++ b/projectional-editor/src/commonMain/kotlin/org/modelix/editor/CellTemplate.kt @@ -331,10 +331,10 @@ class ReferenceCellTemplate( private fun getTargetNode(sourceNode: INode): INode? { return sourceNode.getReferenceTarget(link) } - override fun getInstantiationActions(location: INonExistingNode, parameters: CodeCompletionParameters): List? { - val specializedLocation = location.ofSubConcept(concept) - val scope = ScopeAspect.getScope(specializedLocation, link) - val targets = scope.getVisibleElements(specializedLocation, link) + override fun getInstantiationActions(location: INonExistingNode, parameters: CodeCompletionParameters): List { + val sourceNode = NonExistingChild(location.getParent()!!, location.getContainmentLink()!!, location.index()).ofSubConcept(concept) + val scope = ScopeAspect.getScope(sourceNode, link) + val targets = scope.getVisibleElements(sourceNode, link) return targets.map { target -> val text = when (target) { is ExistingNode -> presentation(target.getNode()) ?: "" diff --git a/projectional-editor/src/commonMain/kotlin/org/modelix/scopes/ScopeAspect.kt b/projectional-editor/src/commonMain/kotlin/org/modelix/scopes/ScopeAspect.kt index 7e10435d..a898c9e8 100644 --- a/projectional-editor/src/commonMain/kotlin/org/modelix/scopes/ScopeAspect.kt +++ b/projectional-editor/src/commonMain/kotlin/org/modelix/scopes/ScopeAspect.kt @@ -5,7 +5,6 @@ import org.modelix.aspects.ILanguageAspectFactory import org.modelix.aspects.LanguageAspectsBuilder import org.modelix.aspects.getInstance import org.modelix.editor.INonExistingNode -import org.modelix.editor.NonExistingNode import org.modelix.editor.toNonExisting import org.modelix.metamodel.ITypedNode import org.modelix.metamodel.ITypedReferenceLink