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