FIR IDE: add type parameters support to completion
This commit is contained in:
+8
@@ -28,12 +28,14 @@ internal class HighLevelApiLookupElementFactory {
|
||||
private val classLookupElementFactory = ClassLookupElementFactory()
|
||||
private val variableLookupElementFactory = VariableLookupElementFactory()
|
||||
private val functionLookupElementFactory = FunctionLookupElementFactory()
|
||||
private val typeParameterLookupElementFactory = TypeParameterLookupElementFactory()
|
||||
|
||||
fun createLookupElement(symbol: KtNamedSymbol): LookupElement {
|
||||
val elementBuilder = when (symbol) {
|
||||
is KtFunctionSymbol -> functionLookupElementFactory.createLookup(symbol)
|
||||
is KtVariableLikeSymbol -> variableLookupElementFactory.createLookup(symbol)
|
||||
is KtClassLikeSymbol -> classLookupElementFactory.createLookup(symbol)
|
||||
is KtTypeParameterSymbol -> typeParameterLookupElementFactory.createLookup(symbol)
|
||||
else -> throw IllegalArgumentException("Cannot create a lookup element for $symbol")
|
||||
}
|
||||
|
||||
@@ -54,6 +56,12 @@ private class ClassLookupElementFactory {
|
||||
}
|
||||
}
|
||||
|
||||
private class TypeParameterLookupElementFactory {
|
||||
fun createLookup(symbol: KtTypeParameterSymbol): LookupElementBuilder {
|
||||
return LookupElementBuilder.create(UniqueLookupObject(), symbol.name.asString())
|
||||
}
|
||||
}
|
||||
|
||||
private class VariableLookupElementFactory {
|
||||
fun createLookup(symbol: KtVariableLikeSymbol): LookupElementBuilder {
|
||||
return LookupElementBuilder.create(UniqueLookupObject(), symbol.name.asString())
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@ private object KotlinAvailableScopesCompletionContributor {
|
||||
|
||||
extensionNonMembers.forEach(::addToCompletion)
|
||||
|
||||
val availableClasses = implicitScopes.getClassClassLikeSymbols()
|
||||
val availableClasses = implicitScopes.getClassifierSymbols()
|
||||
availableClasses.forEach(::addToCompletion)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user