mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
java completion: prefer similar names with mismatching case (IDEA-188085)
This commit is contained in:
@@ -23,6 +23,7 @@ import com.intellij.codeInsight.lookup.*;
|
||||
import com.intellij.openapi.roots.ProjectFileIndex;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
|
||||
@@ -280,7 +281,9 @@ public class JavaCompletionSorting {
|
||||
for (int i = 0; i < limit; i++) {
|
||||
String word = words.get(words.size() - i - 1);
|
||||
String expectedWord = expectedWords[expectedWords.length - i - 1];
|
||||
if (word.equalsIgnoreCase(expectedWord)) {
|
||||
if ( word.equalsIgnoreCase(expectedWord) ||
|
||||
StringUtil.endsWithIgnoreCase(word, expectedWord) ||
|
||||
StringUtil.endsWithIgnoreCase(expectedWord, word)) {
|
||||
max = Math.max(max, i + 1);
|
||||
}
|
||||
else {
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
class Bar {
|
||||
Goo a;
|
||||
Goo b;
|
||||
Goo superclass;
|
||||
}
|
||||
class Goo {}
|
||||
|
||||
class Foo {
|
||||
Bar b;
|
||||
|
||||
void method(Goo superClass) {} //note case difference
|
||||
|
||||
{
|
||||
method(<caret>)
|
||||
}
|
||||
}
|
||||
+5
-13
@@ -22,7 +22,6 @@ import com.intellij.codeInsight.lookup.LookupElementPresentation;
|
||||
import com.intellij.codeInsight.lookup.LookupManager;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.util.ThrowableRunnable;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
@SuppressWarnings({"ALL"})
|
||||
public class SecondSmartTypeCompletionTest extends LightFixtureCompletionTestCase {
|
||||
@@ -180,13 +179,6 @@ public class SecondSmartTypeCompletionTest extends LightFixtureCompletionTestCas
|
||||
checkResult();
|
||||
}
|
||||
|
||||
protected void checkResultByFile(@NonNls final String filePath) {
|
||||
if (myItems != null) {
|
||||
//System.out.println("items = " + Arrays.asList(myItems));
|
||||
}
|
||||
super.checkResultByFile(filePath);
|
||||
}
|
||||
|
||||
public void testChainDuplicationAfterInstanceof() {
|
||||
configure();
|
||||
assertStringItems("test.test", "toString");
|
||||
@@ -228,13 +220,13 @@ public class SecondSmartTypeCompletionTest extends LightFixtureCompletionTestCas
|
||||
assertEquals("Collections.emptyMap", presentation.getItemText());
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
LookupManager.getInstance(getProject()).hideActiveLookup();
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void testNoThisFieldsInDelegatingConstructorCall() {
|
||||
configure();
|
||||
assertOrderedEquals(myFixture.getLookupElementStrings(), "delegate.field", "x");
|
||||
}
|
||||
|
||||
public void testPreferChainFieldSuggestionByExpectedName() {
|
||||
configure();
|
||||
myFixture.assertPreferredCompletionItems(0, "b.superclass", "b.b", "b.a");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user