Fix minor compile warnings
This commit is contained in:
+2
-2
@@ -46,7 +46,7 @@ object PackageDirectiveCompletion {
|
||||
val prefixLength = parameters.offset - expression.textOffset
|
||||
val prefix = expression.text!!
|
||||
val prefixMatcher = PlainPrefixMatcher(prefix.substring(0, prefixLength))
|
||||
val result = result.withPrefixMatcher(prefixMatcher)
|
||||
val resultSet = result.withPrefixMatcher(prefixMatcher)
|
||||
|
||||
val resolutionFacade = expression.getResolutionFacade()
|
||||
|
||||
@@ -57,7 +57,7 @@ object PackageDirectiveCompletion {
|
||||
for (variant in variants) {
|
||||
val lookupElement = lookupElementFactory.createLookupElement(variant)
|
||||
if (!lookupElement.lookupString.contains(DUMMY_IDENTIFIER)) {
|
||||
result.addElement(lookupElement)
|
||||
resultSet.addElement(lookupElement)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -123,8 +123,8 @@ class VariableOrParameterNameWithTypeCompletion(
|
||||
val parameterType = descriptor.type
|
||||
if (parameterType.isVisible(visibilityFilter)) {
|
||||
val lookupElement = MyLookupElement.create(name, ArbitraryType(parameterType), withType, lookupElementFactory)!!
|
||||
val (count, name) = lookupElementToCount[lookupElement] ?: Pair(0, name)
|
||||
lookupElementToCount[lookupElement] = Pair(count + 1, name)
|
||||
val (count, s) = lookupElementToCount[lookupElement] ?: Pair(0, name)
|
||||
lookupElementToCount[lookupElement] = Pair(count + 1, s)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+20
-14
@@ -84,22 +84,28 @@ object LambdaItems {
|
||||
}
|
||||
|
||||
private fun createLookupElement(
|
||||
functionType: KotlinType,
|
||||
functionExpectedInfos: List<ExpectedInfo>,
|
||||
signaturePresentation: LambdaSignatureTemplates.SignaturePresentation,
|
||||
explicitParameterTypes: Boolean
|
||||
functionType: KotlinType,
|
||||
functionExpectedInfos: List<ExpectedInfo>,
|
||||
signaturePresentation: LambdaSignatureTemplates.SignaturePresentation,
|
||||
explicitParameterTypes: Boolean
|
||||
): LookupElement {
|
||||
val lookupString = LambdaSignatureTemplates.lambdaPresentation(functionType, signaturePresentation)
|
||||
return LookupElementBuilder.create(lookupString)
|
||||
.withInsertHandler({ context, lookupElement ->
|
||||
val offset = context.startOffset
|
||||
val placeholder = "{}"
|
||||
context.document.replaceString(offset, context.tailOffset, placeholder)
|
||||
val placeholderRange = TextRange(offset, offset + placeholder.length)
|
||||
LambdaSignatureTemplates.insertTemplate(context, placeholderRange, functionType, explicitParameterTypes, signatureOnly = false)
|
||||
})
|
||||
.suppressAutoInsertion()
|
||||
.assignSmartCompletionPriority(SmartCompletionItemPriority.LAMBDA)
|
||||
.addTailAndNameSimilarity(functionExpectedInfos.filter { it.fuzzyType?.type == functionType })
|
||||
.withInsertHandler { context, _ ->
|
||||
val offset = context.startOffset
|
||||
val placeholder = "{}"
|
||||
context.document.replaceString(offset, context.tailOffset, placeholder)
|
||||
val placeholderRange = TextRange(offset, offset + placeholder.length)
|
||||
LambdaSignatureTemplates.insertTemplate(
|
||||
context,
|
||||
placeholderRange,
|
||||
functionType,
|
||||
explicitParameterTypes,
|
||||
signatureOnly = false
|
||||
)
|
||||
}
|
||||
.suppressAutoInsertion()
|
||||
.assignSmartCompletionPriority(SmartCompletionItemPriority.LAMBDA)
|
||||
.addTailAndNameSimilarity(functionExpectedInfos.filter { it.fuzzyType?.type == functionType })
|
||||
}
|
||||
}
|
||||
|
||||
+17
-11
@@ -64,9 +64,9 @@ object LambdaSignatureItems {
|
||||
}
|
||||
|
||||
private fun createLookupElement(
|
||||
functionType: KotlinType,
|
||||
signaturePresentation: LambdaSignatureTemplates.SignaturePresentation,
|
||||
explicitParameterTypes: Boolean
|
||||
functionType: KotlinType,
|
||||
signaturePresentation: LambdaSignatureTemplates.SignaturePresentation,
|
||||
explicitParameterTypes: Boolean
|
||||
): LookupElement {
|
||||
val lookupString = LambdaSignatureTemplates.signaturePresentation(functionType, signaturePresentation)
|
||||
val priority = if (explicitParameterTypes)
|
||||
@@ -74,13 +74,19 @@ object LambdaSignatureItems {
|
||||
else
|
||||
SmartCompletionItemPriority.LAMBDA_SIGNATURE
|
||||
return LookupElementBuilder.create(lookupString)
|
||||
.withInsertHandler({ context, lookupElement ->
|
||||
val offset = context.startOffset
|
||||
val placeholder = "{}"
|
||||
context.document.replaceString(offset, context.tailOffset, placeholder)
|
||||
LambdaSignatureTemplates.insertTemplate(context, TextRange(offset, offset + placeholder.length), functionType, explicitParameterTypes, signatureOnly = true)
|
||||
})
|
||||
.suppressAutoInsertion()
|
||||
.assignSmartCompletionPriority(priority)
|
||||
.withInsertHandler { context, _ ->
|
||||
val offset = context.startOffset
|
||||
val placeholder = "{}"
|
||||
context.document.replaceString(offset, context.tailOffset, placeholder)
|
||||
LambdaSignatureTemplates.insertTemplate(
|
||||
context,
|
||||
TextRange(offset, offset + placeholder.length),
|
||||
functionType,
|
||||
explicitParameterTypes,
|
||||
signatureOnly = true
|
||||
)
|
||||
}
|
||||
.suppressAutoInsertion()
|
||||
.assignSmartCompletionPriority(priority)
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -169,8 +169,8 @@ class SmartCompletion(
|
||||
val types = descriptor.fuzzyTypesForSmartCompletion(smartCastCalculator, callTypeAndReceiver, resolutionFacade, bindingContext)
|
||||
val infoMatcher = { expectedInfo: ExpectedInfo -> types.matchExpectedInfo(expectedInfo) }
|
||||
|
||||
result.addLookupElements(descriptor, expectedInfos, infoMatcher, noNameSimilarityForReturnItself = callTypeAndReceiver is CallTypeAndReceiver.DEFAULT) { descriptor ->
|
||||
lookupElementFactory.createStandardLookupElementsForDescriptor(descriptor, useReceiverTypes = true)
|
||||
result.addLookupElements(descriptor, expectedInfos, infoMatcher, noNameSimilarityForReturnItself = callTypeAndReceiver is CallTypeAndReceiver.DEFAULT) { declarationDescriptor ->
|
||||
lookupElementFactory.createStandardLookupElementsForDescriptor(declarationDescriptor, useReceiverTypes = true)
|
||||
}
|
||||
|
||||
if (callTypeAndReceiver is CallTypeAndReceiver.DEFAULT) {
|
||||
|
||||
+2
-2
@@ -273,8 +273,8 @@ class TypeInstantiationItems(
|
||||
presentation.itemText = itemText
|
||||
|
||||
presentation.clearTail()
|
||||
if (signatureText != null) {
|
||||
presentation.appendTailText(signatureText!!, false)
|
||||
signatureText?.let {
|
||||
presentation.appendTailText(it, false)
|
||||
}
|
||||
presentation.appendTailText(" (" + DescriptorUtils.getFqName(classifier.containingDeclaration) + ")", true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user