apply start-matching case-insensitively whatever the completion matching option is

This commit is contained in:
peter
2013-02-22 17:07:06 +01:00
parent ae652bdcbd
commit 1e12d6d4fc
3 changed files with 22 additions and 8 deletions
@@ -0,0 +1,12 @@
public class Foo {
Zoo foo() {
return r<caret>
}
void rMethod() {}
}
enum Zoo {
LEFT, RIGHT
}
@@ -98,11 +98,11 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase {
}
public void testDispreferDeclared() throws Throwable {
checkPreferredItems(0, "aabbb", "aaa");
checkPreferredItems(0, "aabbb", "Aaaaaaa", "aaa");
}
public void testDispreferDeclaredOfExpectedType() throws Throwable {
checkPreferredItems(0, "aabbb", "aaa");
checkPreferredItems(0, "aabbb", "Aaaaaaa", "aaa");
}
public void testDispreferImpls() throws Throwable {
@@ -596,4 +596,12 @@ import java.lang.annotation.Target;
assertPreferredItems 0, 'setText', 'setOurText'
}
public void testEnumConstantStartMatching() {
checkPreferredItems(0, 'rMethod', 'Zoo.RIGHT')
myFixture.type('i\n;\nreturn r')
myFixture.completeBasic()
assertPreferredItems 0, 'Zoo.RIGHT', 'rMethod'
}
}
@@ -43,12 +43,6 @@ public class CamelHumpMatcher extends PrefixMatcher {
@Override
public boolean isStartMatch(LookupElement element) {
if (super.isStartMatch(element)) {
return true;
}
if (element.isCaseSensitive()) {
return false;
}
return ContainerUtil.or(element.getAllLookupStrings(), new Condition<String>() {
@Override
public boolean value(String s) {