FIR IDE: Only insert FqNames for non-extension non-members properties

This is not completely correct, will be fixed later
This commit is contained in:
Roman Golyshev
2021-03-02 16:07:19 +03:00
parent bf52417268
commit 83a9b4fb87
@@ -115,7 +115,8 @@ private class VariableLookupElementFactory {
if (setterName != null) "$getterName()/$setterName()" else "$getterName()"
private fun createInsertHandler(symbol: KtVariableLikeSymbol): InsertHandler<LookupElement> {
val callableId = symbol.callableIdIfExists ?: return QuotedNamesAwareInsertionHandler(symbol.name)
val callableId = symbol.callableIdIfExists
if (callableId == null || !symbol.canBeCalledByFqName) return QuotedNamesAwareInsertionHandler(symbol.name)
return ShorteningVariableInsertionHandler(callableId)
}
@@ -133,6 +134,20 @@ private class VariableLookupElementFactory {
is KtConstructorParameterSymbol,
is KtSetterParameterSymbol -> null
}
private val KtVariableLikeSymbol.canBeCalledByFqName: Boolean
get() = when (this) {
is KtKotlinPropertySymbol -> dispatchType == null && receiverType == null
is KtEnumEntrySymbol -> true
is KtJavaFieldSymbol,
is KtSyntheticJavaPropertySymbol,
is KtLocalVariableSymbol,
is KtFunctionParameterSymbol,
is KtConstructorParameterSymbol,
is KtSetterParameterSymbol -> false
}
}
private class FunctionLookupElementFactory {