select the exact prefix match, even if case-insensitive

This commit is contained in:
peter
2011-07-06 18:03:20 +02:00
parent 8690880fa4
commit 6eb83a1ad0
3 changed files with 21 additions and 1 deletions
@@ -0,0 +1,9 @@
class Foo {
void foo1() {}
void foo2() {}
{
foo<caret>
}
}
@@ -249,4 +249,14 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase {
assertEquals(((JavaPsiClassReferenceElement)items.get(1)).getQualifiedName(), "bar.Bar");
}
public void testCaseInsensitivePrefixMatch() {
CodeInsightSettings.getInstance().COMPLETION_CASE_SENSITIVE = CodeInsightSettings.NONE;
try {
checkPreferredItems(0, "Foo", "foo1", "foo2");
}
finally {
CodeInsightSettings.getInstance().COMPLETION_CASE_SENSITIVE = CodeInsightSettings.FIRST_LETTER;
}
}
}
@@ -427,7 +427,8 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
if (!model.isEmpty()) {
myList.setFixedCellWidth(Math.max(myLookupTextWidth + myCellRenderer.getIconIndent(), myAdComponent.getAdComponent().getPreferredSize().width));
if (isFocused() && (!isExactPrefixItem(model.iterator().next(), true) || mySelectionTouched)) {
LookupElement first = model.iterator().next();
if (isFocused() && (!(isExactPrefixItem(first, true) || isExactPrefixItem(first, false)) || mySelectionTouched)) {
restoreSelection(oldSelected, hasPreselected, oldInvariant, snapshot.second);
}
else {