mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
preselect most relevant suggestion instead of prefix-matching one
This commit is contained in:
+3
-6
@@ -741,7 +741,7 @@ class Foo {
|
||||
myFixture.checkResult(" class Foo { { int iteraaa; iteraaa<caret> } } ")
|
||||
assert !lookup
|
||||
}
|
||||
|
||||
|
||||
public void testChoosingItemDuringCopyCommit() {
|
||||
registerContributor(LongReplacementOffsetContributor)
|
||||
|
||||
@@ -1024,8 +1024,7 @@ public class UTest {
|
||||
myFixture.addClass("package xxxxx; public class SYSTEM_EXCEPTION {}")
|
||||
myFixture.configureByText "a.java", "import xxxxx.*; class Foo { S<caret> }"
|
||||
type 'Ystem'
|
||||
assert 'java.lang.System' == ((JavaPsiClassReferenceElement) myFixture.lookupElements[0]).qualifiedName
|
||||
assert 'xxxxx.SYSTEM_EXCEPTION' == ((JavaPsiClassReferenceElement) myFixture.lookupElements[1]).qualifiedName
|
||||
myFixture.assertPreferredCompletionItems 1, 'System', 'SYSTEM_EXCEPTION'
|
||||
}
|
||||
|
||||
public void testSamePrefixIgnoreCase2() {
|
||||
@@ -1033,9 +1032,7 @@ public class UTest {
|
||||
myFixture.addClass("package xxxxx; public class SYstem {}")
|
||||
myFixture.configureByText "a.java", "import xxxxx.*; class Foo { S<caret> }"
|
||||
type 'Ystem'
|
||||
assert 'xxxxx.SYstem' == ((JavaPsiClassReferenceElement) myFixture.lookupElements[0]).qualifiedName
|
||||
assert 'java.lang.System' == ((JavaPsiClassReferenceElement) myFixture.lookupElements[1]).qualifiedName
|
||||
assert 'xxxxx.SYSTEM_EXCEPTION' == ((JavaPsiClassReferenceElement) myFixture.lookupElements[2]).qualifiedName
|
||||
myFixture.assertPreferredCompletionItems 0, 'SYstem', 'System', 'SYSTEM_EXCEPTION'
|
||||
}
|
||||
|
||||
private FileEditor openEditorForUndo() {
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase {
|
||||
final LookupImpl lookup = invokeCompletion(getTestName(false) + ".html");
|
||||
assertPreferredItems(0, "p", "param", "pre");
|
||||
incUseCount(lookup, 2);
|
||||
assertPreferredItems(0, "p", "pre", "param");
|
||||
assertPreferredItems(1, "p", "pre", "param");
|
||||
}
|
||||
|
||||
public void testUppercaseMatters2() throws Throwable {
|
||||
|
||||
+1
-1
@@ -351,7 +351,7 @@ public class CompletionLookupArranger extends LookupArranger {
|
||||
String selectedText = lookup.getEditor().getSelectionModel().getSelectedText();
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
LookupElement item = items.get(i);
|
||||
if (isPrefixItem(lookup, item, true) && !isLiveTemplate(item) ||
|
||||
if (isAlphaSorted() && isPrefixItem(lookup, item, true) && !isLiveTemplate(item) ||
|
||||
item.getLookupString().equals(selectedText)) {
|
||||
return i;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user