mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
java completion: make recursion weigher less important than by-kind, because now it can lead to very unexpected sorting
This commit is contained in:
@@ -75,11 +75,12 @@ public class JavaCompletionSorting {
|
||||
if (!smart) {
|
||||
ContainerUtil.addIfNotNull(afterPrefix, preferStatics(position, expectedTypes));
|
||||
}
|
||||
ContainerUtil.addIfNotNull(afterPrefix, recursion(parameters, expectedTypes));
|
||||
if (!smart && !afterNew) {
|
||||
afterPrefix.add(new PreferExpected(false, expectedTypes));
|
||||
}
|
||||
Collections.addAll(afterPrefix, new PreferByKindWeigher(type, position), new PreferSimilarlyEnding(expectedTypes),
|
||||
afterPrefix.add(new PreferByKindWeigher(type, position));
|
||||
ContainerUtil.addIfNotNull(afterPrefix, recursion(parameters, expectedTypes));
|
||||
Collections.addAll(afterPrefix, new PreferSimilarlyEnding(expectedTypes),
|
||||
new PreferNonGeneric(), new PreferAccessible(position), new PreferSimple());
|
||||
|
||||
sorter = sorter.weighAfter("prefix", afterPrefix.toArray(new LookupElementWeigher[afterPrefix.size()]));
|
||||
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
public class Aaaaaaa {
|
||||
private final String aaa;
|
||||
|
||||
Aaaaaaa(Object aabbb) {
|
||||
aaa = "";
|
||||
aaa = true ? null : aa<caret>
|
||||
}
|
||||
|
||||
}
|
||||
+1
-5
@@ -117,10 +117,6 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase {
|
||||
checkPreferredItems(0, "aabbb", "aaa");
|
||||
}
|
||||
|
||||
public void testDispreferDeclaredOfExpectedType() throws Throwable {
|
||||
checkPreferredItems(0, "aabbb", "aaa");
|
||||
}
|
||||
|
||||
public void testDispreferImpls() throws Throwable {
|
||||
myFixture.addClass("package foo; public class Xxx {}");
|
||||
configureSecondCompletion();
|
||||
@@ -456,7 +452,7 @@ interface TxANotAnno {}
|
||||
myFixture.addClass('public class fooAClass {}')
|
||||
configureNoCompletion(getTestName(false) + ".java");
|
||||
myFixture.complete(CompletionType.BASIC, 2);
|
||||
assertPreferredItems(0, 'fooy', 'fooAClass', 'fooBar', 'foox');
|
||||
assertPreferredItems(0, 'fooy', 'foox', 'fooAClass', 'fooBar');
|
||||
}
|
||||
|
||||
public void testChangePreselectionOnSecondInvocation() {
|
||||
|
||||
+3
-3
@@ -161,7 +161,7 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase {
|
||||
}
|
||||
|
||||
public void testPreferParametersToGetters() throws Throwable {
|
||||
checkPreferredItems(0, "a", "I._1", "valueOf", "getLastI");
|
||||
checkPreferredItems(0, "a", "I._1", "getLastI", "valueOf");
|
||||
}
|
||||
|
||||
public void testExpectedInterfaceShouldGoFirst() throws Throwable {
|
||||
@@ -178,7 +178,7 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase {
|
||||
}
|
||||
|
||||
public void testPreferNonRecursiveMethodParams() throws Throwable {
|
||||
checkPreferredItems(0, "b", "hashCode", "s", "a");
|
||||
checkPreferredItems(0, "b", "s", "a", "hashCode");
|
||||
}
|
||||
|
||||
public void testPreferDelegatingMethodParams() throws Throwable {
|
||||
@@ -302,7 +302,7 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase {
|
||||
}
|
||||
|
||||
public void testDispreferGetterInSetterCall() {
|
||||
checkPreferredItems 0, 'getZooColor', 'hashCode', 'color', 'getColor'
|
||||
checkPreferredItems 0, 'color', 'getZooColor', 'getColor', 'hashCode'
|
||||
}
|
||||
public void testPreferOtherGetterInSetterCall() {
|
||||
checkPreferredItems 0, 'color', 'getColor', 'getZooColor', 'hashCode'
|
||||
|
||||
Reference in New Issue
Block a user