mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-84754 Completion preselect the specified value if it is selected in editor
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
public class FooBar {
|
||||
|
||||
int a() {
|
||||
<caret><selection>finalize</selection>
|
||||
}
|
||||
|
||||
}
|
||||
+6
@@ -632,6 +632,12 @@ public class ListUtils {
|
||||
public void testQualifierAsPackage3() throws Throwable {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testPreselectEditorSelection() {
|
||||
configure()
|
||||
assert lookup.currentItem != myFixture.lookupElements[0]
|
||||
assert 'finalize' == lookup.currentItem.lookupString
|
||||
}
|
||||
|
||||
public void testPackageNamedVariableBeforeAssignment() throws Throwable {
|
||||
doTest();
|
||||
|
||||
+3
-1
@@ -215,9 +215,11 @@ 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 (isPrefixItem(lookup, item, true) && !isLiveTemplate(item) ||
|
||||
item.getLookupString().equals(selectedText)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user