Completion: assign highest priority to dsl members in dsl context

Use the same style as for dsl for lookup items that belong to dsl
This commit is contained in:
Pavel V. Talanov
2018-02-09 16:22:37 +01:00
parent 8f8cbfcfa5
commit 1796d40118
13 changed files with 191 additions and 17 deletions
@@ -141,7 +141,8 @@ class KotlinIndicesHelper(
fun getCallableTopLevelExtensions(
callTypeAndReceiver: CallTypeAndReceiver<*, *>,
receiverTypes: Collection<KotlinType>,
nameFilter: (String) -> Boolean
nameFilter: (String) -> Boolean,
declarationFilter: (KtDeclaration) -> Boolean = { true }
): Collection<CallableDescriptor> {
if (receiverTypes.isEmpty()) return emptyList()
@@ -157,7 +158,7 @@ class KotlinIndicesHelper(
KotlinTopLevelExtensionsByReceiverTypeIndex.receiverTypeNameFromKey(it) in receiverTypeNames
&& nameFilter(KotlinTopLevelExtensionsByReceiverTypeIndex.callableNameFromKey(it))
}
.flatMap { index.get(it, project, scope).asSequence() }
.flatMap { index.get(it, project, scope).asSequence() }.filter(declarationFilter)
val suitableExtensions = findSuitableExtensions(declarations, receiverTypes, callTypeAndReceiver.callType)