No double-filtering
This commit is contained in:
@@ -211,11 +211,7 @@ class SmartCompletionSession(configuration: CompletionSessionConfiguration, para
|
|||||||
|
|
||||||
val filter = result.declarationFilter
|
val filter = result.declarationFilter
|
||||||
if (filter != null) {
|
if (filter != null) {
|
||||||
getReferenceVariants(DESCRIPTOR_KIND_MASK).forEach {
|
getReferenceVariants(DESCRIPTOR_KIND_MASK).forEach { collector.addElements(filter(it)) }
|
||||||
if (prefixMatcher.prefixMatches(it.getName().asString())) {
|
|
||||||
collector.addElements(filter(it))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
flushToResultSet()
|
flushToResultSet()
|
||||||
|
|
||||||
|
|||||||
@@ -107,8 +107,7 @@ class SmartCompletion(val expression: JetSimpleNameExpression,
|
|||||||
|
|
||||||
fun filterDeclaration(descriptor: DeclarationDescriptor): Collection<LookupElement> {
|
fun filterDeclaration(descriptor: DeclarationDescriptor): Collection<LookupElement> {
|
||||||
val result = ArrayList<LookupElement>()
|
val result = ArrayList<LookupElement>()
|
||||||
if (!itemsToSkip.contains(descriptor)
|
if (!itemsToSkip.contains(descriptor)) {
|
||||||
&& descriptor !is SamConstructorDescriptor /* SAM-constructor is added explicitly and is not needed here */) {
|
|
||||||
val types = typesWithSmartCasts(descriptor)
|
val types = typesWithSmartCasts(descriptor)
|
||||||
val nonNullTypes = types.map { it.makeNotNullable() }
|
val nonNullTypes = types.map { it.makeNotNullable() }
|
||||||
val classifier = { (expectedInfo: ExpectedInfo) ->
|
val classifier = { (expectedInfo: ExpectedInfo) ->
|
||||||
|
|||||||
+5
-11
@@ -413,19 +413,13 @@ public class JetFunctionParameterInfoHandler implements ParameterInfoHandlerWith
|
|||||||
Collection<Pair<? extends DeclarationDescriptor, ResolveSessionForBodies>> itemsToShow = new ArrayList<Pair<? extends DeclarationDescriptor, ResolveSessionForBodies>>();
|
Collection<Pair<? extends DeclarationDescriptor, ResolveSessionForBodies>> itemsToShow = new ArrayList<Pair<? extends DeclarationDescriptor, ResolveSessionForBodies>>();
|
||||||
for (DeclarationDescriptor variant : variants) {
|
for (DeclarationDescriptor variant : variants) {
|
||||||
if (variant instanceof FunctionDescriptor) {
|
if (variant instanceof FunctionDescriptor) {
|
||||||
FunctionDescriptor functionDescriptor = (FunctionDescriptor) variant;
|
//todo: renamed functions?
|
||||||
if (functionDescriptor.getName().equals(refName)) {
|
itemsToShow.add(Pair.create((FunctionDescriptor) variant, resolveSession));
|
||||||
//todo: renamed functions?
|
|
||||||
itemsToShow.add(Pair.create(functionDescriptor, resolveSession));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (variant instanceof ClassDescriptor) {
|
else if (variant instanceof ClassDescriptor) {
|
||||||
ClassDescriptor classDescriptor = (ClassDescriptor) variant;
|
//todo: renamed classes?
|
||||||
if (classDescriptor.getName().equals(refName)) {
|
for (ConstructorDescriptor constructorDescriptor : ((ClassDescriptor) variant).getConstructors()) {
|
||||||
//todo: renamed classes?
|
itemsToShow.add(Pair.create(constructorDescriptor, resolveSession));
|
||||||
for (ConstructorDescriptor constructorDescriptor : classDescriptor.getConstructors()) {
|
|
||||||
itemsToShow.add(Pair.create(constructorDescriptor, resolveSession));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user