KT-13266 Non-imported type aliases do not appear in completion

#KT-13266 Fixed
This commit is contained in:
Valentin Kipyatkov
2016-08-31 20:15:57 +03:00
parent fcce1e3838
commit 50a0f9a4a7
14 changed files with 124 additions and 40 deletions
@@ -22,6 +22,7 @@ import com.intellij.navigation.ItemPresentationProviders
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.KtNodeTypes
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub
import org.jetbrains.kotlin.psi.stubs.KotlinTypeAliasStub
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes
@@ -40,8 +41,15 @@ class KtTypeAlias : KtTypeParameterListOwnerStub<KotlinTypeAliasStub>, KtNamedDe
findChildByType(KtTokens.TYPE_ALIAS_KEYWORD)
@IfNotParsed
fun getTypeReference(): KtTypeReference? =
findChildByType(KtNodeTypes.TYPE_REFERENCE)
fun getTypeReference(): KtTypeReference? {
if (stub != null) {
val typeReferences = getStubOrPsiChildrenAsList<KtTypeReference, KotlinPlaceHolderStub<KtTypeReference>>(KtStubElementTypes.TYPE_REFERENCE)
return typeReferences[0]
}
else {
return findChildByType(KtNodeTypes.TYPE_REFERENCE)
}
}
override fun getPresentation() = ItemPresentationProviders.getItemPresentation(this)
}