FIR IDE: remove error handling from function completion
This commit is contained in:
committed by
TeamCityServer
parent
a1fcc34bbc
commit
ae7a6dc742
+2
-2
@@ -50,8 +50,8 @@ internal abstract class FirCompletionContributorBase<C : FirRawPositionCompletio
|
||||
if (symbol !is KtNamedSymbol) return
|
||||
with(lookupElementFactory) {
|
||||
createLookupElement(symbol)
|
||||
?.let { applyWeighers(it, symbol, expectedType) }
|
||||
?.let(sink::addElement)
|
||||
.let { applyWeighers(it, symbol, expectedType) }
|
||||
.let(sink::addElement)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-17
@@ -40,7 +40,7 @@ internal class FunctionLookupElementFactory {
|
||||
symbol: KtFunctionSymbol,
|
||||
importStrategy: CallableImportStrategy,
|
||||
insertionStrategy: CallableInsertionStrategy
|
||||
): LookupElementBuilder? {
|
||||
): LookupElementBuilder {
|
||||
val lookupObject = FunctionLookupObject(
|
||||
symbol.name,
|
||||
importStrategy = importStrategy,
|
||||
@@ -55,22 +55,11 @@ internal class FunctionLookupElementFactory {
|
||||
CallableInsertionStrategy.AS_IDENTIFIER -> QuotedNamesAwareInsertionHandler()
|
||||
}
|
||||
|
||||
return try {
|
||||
LookupElementBuilder.create(lookupObject, symbol.name.asString())
|
||||
.withTailText(getTailText(symbol), true)
|
||||
.withTypeText(symbol.annotatedType.type.render(CompletionShortNamesRenderer.TYPE_RENDERING_OPTIONS))
|
||||
.withInsertHandler(insertionHandler)
|
||||
.let { withSymbolInfo(symbol, it) }
|
||||
} catch (e: Throwable) {
|
||||
if (e is ControlFlowException) throw e
|
||||
LOG.error(e)
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
companion object {
|
||||
private val LOG = logger<FunctionLookupElementFactory>()
|
||||
return LookupElementBuilder.create(lookupObject, symbol.name.asString())
|
||||
.withTailText(getTailText(symbol), true)
|
||||
.withTypeText(symbol.annotatedType.type.render(CompletionShortNamesRenderer.TYPE_RENDERING_OPTIONS))
|
||||
.withInsertHandler(insertionHandler)
|
||||
.let { withSymbolInfo(symbol, it) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ internal class KotlinFirLookupElementFactory {
|
||||
private val typeParameterLookupElementFactory = TypeParameterLookupElementFactory()
|
||||
private val packagePartLookupElementFactory = PackagePartLookupElementFactory()
|
||||
|
||||
fun KtAnalysisSession.createLookupElement(symbol: KtNamedSymbol): LookupElement? {
|
||||
fun KtAnalysisSession.createLookupElement(symbol: KtNamedSymbol): LookupElement {
|
||||
return when (symbol) {
|
||||
is KtCallableSymbol -> createCallableLookupElement(
|
||||
symbol,
|
||||
@@ -39,7 +39,7 @@ internal class KotlinFirLookupElementFactory {
|
||||
symbol: KtCallableSymbol,
|
||||
importingStrategy: CallableImportStrategy,
|
||||
insertionStrategy: CallableInsertionStrategy,
|
||||
): LookupElementBuilder? {
|
||||
): LookupElementBuilder {
|
||||
return when (symbol) {
|
||||
is KtFunctionSymbol -> with(functionLookupElementFactory) { createLookup(symbol, importingStrategy, insertionStrategy) }
|
||||
is KtVariableLikeSymbol -> with(variableLookupElementFactory) { createLookup(symbol, importingStrategy) }
|
||||
|
||||
Reference in New Issue
Block a user