diff --git a/src/main/kotlin/platform/mixin/expression/MEExpressionAnnotator.kt b/src/main/kotlin/platform/mixin/expression/MEExpressionAnnotator.kt index 1c70d2326..638bf6f13 100644 --- a/src/main/kotlin/platform/mixin/expression/MEExpressionAnnotator.kt +++ b/src/main/kotlin/platform/mixin/expression/MEExpressionAnnotator.kt @@ -344,6 +344,7 @@ class MEExpressionAnnotator : Annotator { ) { if (editor == null) { MEExpressionCompletionUtil.addDefinition( + project, startElement, id, "" @@ -351,6 +352,7 @@ class MEExpressionAnnotator : Annotator { return } val annotation = MEExpressionCompletionUtil.addDefinition( + project, startElement, id, "dummy" diff --git a/src/main/kotlin/platform/mixin/expression/MEExpressionCompletionUtil.kt b/src/main/kotlin/platform/mixin/expression/MEExpressionCompletionUtil.kt index 3801ad83f..c172b57d6 100644 --- a/src/main/kotlin/platform/mixin/expression/MEExpressionCompletionUtil.kt +++ b/src/main/kotlin/platform/mixin/expression/MEExpressionCompletionUtil.kt @@ -1178,11 +1178,15 @@ object MEExpressionCompletionUtil { private fun addDefinition(context: InsertionContext, id: String, definitionValue: String): PsiAnnotation? { val contextElement = context.file.findElementAt(context.startOffset) ?: return null - return addDefinition(contextElement, id, definitionValue) + return addDefinition(context.project, contextElement, id, definitionValue) } - fun addDefinition(contextElement: PsiElement, id: String, definitionValue: String): PsiAnnotation? { - val project = contextElement.project + fun addDefinition( + project: Project, + contextElement: PsiElement, + id: String, + definitionValue: String + ): PsiAnnotation? { val injectionHost = contextElement.findMultiInjectionHost() ?: return null val expressionAnnotation = injectionHost.parentOfType() ?: return null if (!expressionAnnotation.hasQualifiedName(MixinConstants.MixinExtras.EXPRESSION)) {