Skip to content

Commit

Permalink
[ cubical ] Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ice1000 committed May 18, 2019
1 parent 7d1c087 commit 57659a1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/org/ice1000/tt/editing/cubicaltt/completion.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -26,14 +29,15 @@ class CubicalTTCompletionContributor : CompletionContributor(), DumbAware {

init {
extend(CompletionType.BASIC, psiElement(), SimpleProvider(keywords))
extend(CompletionType.BASIC, psiElement(CubicalTTTypes.NAME_EXP), object : CompletionProvider<CompletionParameters>() {
extend(CompletionType.BASIC, psiElement(), object : CompletionProvider<CompletionParameters>() {
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<CubicalTTImportMixin>()
.mapNotNull { it.moduleUsage }
.mapNotNull { it.reference?.resolve() }
Expand Down

0 comments on commit 57659a1

Please sign in to comment.