mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-09 08:09:39 +07:00
honor 'exclude from completion' settings (IDEA-54855)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||
import com.intellij.codeInsight.CodeInsightSettings
|
||||
import com.intellij.util.ArrayUtil;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
@@ -17,13 +19,56 @@ public class Foo {
|
||||
}
|
||||
""")
|
||||
|
||||
myFixture.configureByText("a.java", "class Bar {{ abcm<caret> }}")
|
||||
|
||||
myFixture.complete(CompletionType.CLASS_NAME)
|
||||
myFixture.type('\n')
|
||||
myFixture.checkResult """import static foo.Foo.abcmethod;
|
||||
doTest "class Bar {{ abcm<caret> }}", """import static foo.Foo.abcmethod;
|
||||
|
||||
class Bar {{ abcmethod()<caret> }}"""
|
||||
}
|
||||
|
||||
@Override protected void tearDown() {
|
||||
CodeInsightSettings.instance.EXCLUDED_PACKAGES = ArrayUtil.EMPTY_STRING_ARRAY
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
public void testExcludeClassFromCompletion() throws Exception {
|
||||
myFixture.addClass("""package foo;
|
||||
public class Foo {
|
||||
public static int abcmethod() {}
|
||||
}
|
||||
""")
|
||||
myFixture.addClass("""package foo;
|
||||
public class Excl {
|
||||
public static int abcmethod2() {}
|
||||
}
|
||||
""")
|
||||
|
||||
CodeInsightSettings.instance.EXCLUDED_PACKAGES = ["foo.Excl"] as String[]
|
||||
|
||||
doTest "class Bar {{ abcm<caret> }}", """import static foo.Foo.abcmethod;
|
||||
|
||||
class Bar {{ abcmethod()<caret> }}"""
|
||||
}
|
||||
|
||||
public void testExcludeMethodFromCompletion() throws Exception {
|
||||
myFixture.addClass("""package foo;
|
||||
public class Foo {
|
||||
public static int abcmethod1() {}
|
||||
public static int abcmethodExcluded() {}
|
||||
}
|
||||
""")
|
||||
|
||||
CodeInsightSettings.instance.EXCLUDED_PACKAGES = ["foo.Foo.abcmethodExcluded"] as String[]
|
||||
|
||||
doTest "class Bar {{ abcm<caret> }}", """import static foo.Foo.abcmethod1;
|
||||
|
||||
class Bar {{ abcmethod1()<caret> }}"""
|
||||
}
|
||||
|
||||
private void doTest(String input, String output) {
|
||||
myFixture.configureByText("a.java", input)
|
||||
|
||||
assertOneElement myFixture.complete(CompletionType.CLASS_NAME)
|
||||
myFixture.type('\n')
|
||||
myFixture.checkResult output
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user