From ae7a6dc7427f260c31b8cd0ce0def9de24d5172e Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Wed, 2 Jun 2021 00:36:12 +0200 Subject: [PATCH] FIR IDE: remove error handling from function completion --- .../FirCompletionContributorBase.kt | 4 ++-- .../factories/FunctionLookupElementFactory.kt | 23 +++++-------------- .../KotlinFirLookupElementFactory.kt | 4 ++-- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/contributors/FirCompletionContributorBase.kt b/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/contributors/FirCompletionContributorBase.kt index 320466148c3..948e8d654f8 100644 --- a/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/contributors/FirCompletionContributorBase.kt +++ b/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/contributors/FirCompletionContributorBase.kt @@ -50,8 +50,8 @@ internal abstract class FirCompletionContributorBase 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() + 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) } } } diff --git a/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/lookups/factories/KotlinFirLookupElementFactory.kt b/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/lookups/factories/KotlinFirLookupElementFactory.kt index 2104a881941..05e913f2caf 100644 --- a/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/lookups/factories/KotlinFirLookupElementFactory.kt +++ b/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/lookups/factories/KotlinFirLookupElementFactory.kt @@ -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) }