From 57659a12115835e6ec179bf99fb77717b7aafe16 Mon Sep 17 00:00:00 2001 From: ice1000 Date: Sat, 18 May 2019 12:24:25 -0700 Subject: [PATCH] [ cubical ] Fix --- src/org/ice1000/tt/editing/cubicaltt/completion.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/org/ice1000/tt/editing/cubicaltt/completion.kt b/src/org/ice1000/tt/editing/cubicaltt/completion.kt index 7ebf4ad..7f32145 100644 --- a/src/org/ice1000/tt/editing/cubicaltt/completion.kt +++ b/src/org/ice1000/tt/editing/cubicaltt/completion.kt @@ -8,7 +8,10 @@ import com.intellij.util.ProcessingContext import icons.TTIcons import org.ice1000.tt.editing.SimpleProvider import org.ice1000.tt.psi.childrenWithLeaves -import org.ice1000.tt.psi.cubicaltt.* +import org.ice1000.tt.psi.cubicaltt.CubicalCompletionElement +import org.ice1000.tt.psi.cubicaltt.CubicalTTFileImpl +import org.ice1000.tt.psi.cubicaltt.CubicalTTImportMixin +import org.ice1000.tt.psi.cubicaltt.CubicalTTModuleMixin class CubicalTTCompletionContributor : CompletionContributor(), DumbAware { private val keywords = listOf( @@ -26,14 +29,15 @@ class CubicalTTCompletionContributor : CompletionContributor(), DumbAware { init { extend(CompletionType.BASIC, psiElement(), SimpleProvider(keywords)) - extend(CompletionType.BASIC, psiElement(CubicalTTTypes.NAME_EXP), object : CompletionProvider() { + extend(CompletionType.BASIC, psiElement(), object : CompletionProvider() { override fun addCompletions( parameters: CompletionParameters, context: ProcessingContext, result: CompletionResultSet ) { val file = parameters.originalFile as? CubicalTTFileImpl ?: return - file.childrenWithLeaves + val module = file.module ?: return + module.childrenWithLeaves .filterIsInstance() .mapNotNull { it.moduleUsage } .mapNotNull { it.reference?.resolve() }