Skip to content

Commit

Permalink
Add completion for SomeId
Browse files Browse the repository at this point in the history
  • Loading branch information
atsky committed Jul 1, 2014
1 parent 5282bfa commit 3eb3485
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.intellij.psi.PsiElement
import org.jetbrains.haskell.psi.Module
import org.jetbrains.haskell.fileType.HaskellFile
import org.jetbrains.haskell.scope.ModuleScope
import java.util.ArrayList

/**
* Created by atsky on 4/11/14.
Expand Down Expand Up @@ -43,7 +44,16 @@ class SomeIdReference(val someId : SomeId) : PsiReferenceBase<SomeId>(
}


override fun getVariants(): Array<Any> = array()
override fun getVariants(): Array<Any> {
val module = Module.findModule(someId)
var result = ArrayList<Any>()
if (module != null) {
result.addAll(ModuleScope(module).getVisibleTypes())
result.addAll(ModuleScope(module).getVisibleConstructors())
result.addAll(ModuleScope(module).getVisibleValues().flatMap { it.getNames() })
}
return result.toArray().requireNoNulls()
}


}

0 comments on commit 3eb3485

Please sign in to comment.