mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
compete 'class' after abstract method
This commit is contained in:
@@ -88,7 +88,6 @@ public class KeywordHighlighter extends TextEditorHighlightingPass {
|
||||
@Override
|
||||
public void doApplyInformationToEditor() {
|
||||
if (toHighlight == null) return;
|
||||
UpdateHighlightersUtil.setHighlightersToEditor(myProject, myDocument, 0, myFile.getTextLength(), toHighlight, getColorsScheme(),
|
||||
getId());
|
||||
UpdateHighlightersUtil.setHighlightersToEditor(myProject, myDocument, 0, myFile.getTextLength(), toHighlight, getColorsScheme(), getId());
|
||||
}
|
||||
}
|
||||
|
||||
+14
-7
@@ -52,7 +52,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.*;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrLiteral;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.*;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMember;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.imports.GrImportStatement;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.packaging.GrPackageDefinition;
|
||||
@@ -111,9 +110,10 @@ public class GroovyCompletionData {
|
||||
if (isAfterForParameter(position)) {
|
||||
addKeywords(result, true, "in");
|
||||
}
|
||||
else if (isInfixOperatorPosition(position)) {
|
||||
if (isInfixOperatorPosition(position)) {
|
||||
addKeywords(result, true, "in", PsiKeyword.INSTANCEOF);
|
||||
} else if (suggestThrows(position)) {
|
||||
}
|
||||
if (afterAbstractMethod(position)) {
|
||||
result.addElement(keyword(PsiKeyword.THROWS, TailType.INSERT_SPACE));
|
||||
}
|
||||
if (suggestPrimitiveTypes(position)) {
|
||||
@@ -263,7 +263,8 @@ public class GroovyCompletionData {
|
||||
|
||||
public static void addGroovyDocKeywords(CompletionParameters parameters, CompletionResultSet result) {
|
||||
PsiElement position = parameters.getPosition();
|
||||
if (PlatformPatterns.psiElement(GroovyDocTokenTypes.mGDOC_TAG_NAME).andNot(PlatformPatterns.psiElement().afterLeaf(".")).accepts(position)) {
|
||||
if (PlatformPatterns.psiElement(GroovyDocTokenTypes.mGDOC_TAG_NAME).andNot(PlatformPatterns.psiElement().afterLeaf(".")).accepts(
|
||||
position)) {
|
||||
String[] tags = position.getParent() instanceof GrDocInlinedTag ? INLINED_DOC_TAGS : DOC_TAGS;
|
||||
for (String docTag : tags) {
|
||||
result.addElement(TailTypeDecorator.withTail(LookupElementBuilder.create(docTag), TailType.INSERT_SPACE));
|
||||
@@ -321,7 +322,9 @@ public class GroovyCompletionData {
|
||||
}
|
||||
|
||||
public static boolean suggestClassInterfaceEnum(PsiElement context) {
|
||||
if (suggestThrows(context) || addExtendsImplements(context).length > 0) {
|
||||
PsiElement nextNonSpace = PsiUtil.getNextNonSpace(context);
|
||||
if (nextNonSpace instanceof PsiErrorElement) nextNonSpace = PsiUtil.getNextNonSpace(nextNonSpace);
|
||||
if (afterAbstractMethod(context) && nextNonSpace != null && nextNonSpace.getText().startsWith("{") || addExtendsImplements(context).length > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -486,7 +489,7 @@ public class GroovyCompletionData {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean suggestThrows(PsiElement context) {
|
||||
private static boolean afterAbstractMethod(PsiElement context) {
|
||||
PsiElement candidate = null;
|
||||
if (GroovyCompletionUtil.isInTypeDefinitionBody(context)) {
|
||||
PsiElement run = context;
|
||||
@@ -494,7 +497,8 @@ public class GroovyCompletionData {
|
||||
run = run.getParent();
|
||||
assert run != null;
|
||||
}
|
||||
candidate = PsiTreeUtil.getPrevSiblingOfType(run, GrMember.class);
|
||||
candidate = PsiUtil.skipWhitespaces(run.getPrevSibling(), false);
|
||||
if (candidate instanceof PsiErrorElement) candidate = candidate.getPrevSibling();
|
||||
}
|
||||
else if (context.getParent() instanceof PsiErrorElement) {
|
||||
candidate = context.getParent().getPrevSibling();
|
||||
@@ -504,6 +508,9 @@ public class GroovyCompletionData {
|
||||
}
|
||||
|
||||
private static boolean suggestPrimitiveTypes(PsiElement context) {
|
||||
if (isInfixOperatorPosition(context)) return false;
|
||||
if (isAfterForParameter(context)) return false;
|
||||
|
||||
final PsiElement parent = context.getParent();
|
||||
if (parent == null) return false;
|
||||
|
||||
|
||||
@@ -828,6 +828,7 @@ public class PsiUtil {
|
||||
return place == clazz;
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
public static PsiElement skipWhitespaces(@Nullable PsiElement elem, boolean forward) {
|
||||
//noinspection ConstantConditions
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.intellij.codeInsight.lookup.impl.LookupImpl;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiMember;
|
||||
import com.intellij.psi.PsiPackage;
|
||||
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
|
||||
@@ -23,10 +24,10 @@ import java.util.List;
|
||||
*/
|
||||
public abstract class CompletionTestBase extends JavaCodeInsightFixtureTestCase {
|
||||
|
||||
protected void doTest() throws Throwable {
|
||||
protected void doTest() {
|
||||
doTest("");
|
||||
}
|
||||
protected void doTest(String directory) throws Throwable {
|
||||
protected void doTest(String directory) {
|
||||
final List<String> stringList = TestUtils.readInput(getTestDataPath() + "/" + getTestName(true) + ".test");
|
||||
if (directory.length()!=0) directory += "/";
|
||||
final String fileName = directory + getTestName(true) + "." + getExtension();
|
||||
@@ -50,7 +51,7 @@ public abstract class CompletionTestBase extends JavaCodeInsightFixtureTestCase
|
||||
@Override
|
||||
public boolean value(LookupElement lookupElement) {
|
||||
final Object o = lookupElement.getObject();
|
||||
return !(o instanceof PsiMember) && !(o instanceof GrVariable) && !(o instanceof GroovyResolveResult);
|
||||
return !(o instanceof PsiMember) && !(o instanceof GrVariable) && !(o instanceof GroovyResolveResult) && !(o instanceof PsiPackage);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -80,10 +81,6 @@ public abstract class CompletionTestBase extends JavaCodeInsightFixtureTestCase
|
||||
return "groovy";
|
||||
}
|
||||
|
||||
protected boolean addKeywords() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean addReferenceVariants() {
|
||||
return true;
|
||||
}
|
||||
|
||||
+62
-62
@@ -32,7 +32,7 @@ import org.jetbrains.plugins.groovy.util.TestUtils
|
||||
public class GroovyCompletionTest extends GroovyCompletionTestBase {
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return TestUtils.getTestDataPath() + "groovy/completion/";
|
||||
return TestUtils.testDataPath + "groovy/completion/";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,194 +41,194 @@ public class GroovyCompletionTest extends GroovyCompletionTestBase {
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
public void testFinishMethodWithLParen() throws Throwable {
|
||||
public void testFinishMethodWithLParen() {
|
||||
myFixture.testCompletionVariants(getTestName(false) + ".groovy", "getBar", "getClass", "getFoo");
|
||||
myFixture.type('(');
|
||||
myFixture.checkResultByFile(getTestName(false) + "_after.groovy");
|
||||
}
|
||||
|
||||
public void testNamedParametersForApplication() throws Throwable {
|
||||
public void testNamedParametersForApplication() {
|
||||
doVariantableTest("abx", "aby");
|
||||
}
|
||||
|
||||
public void testNamedParametersForMethodCall() throws Throwable {
|
||||
public void testNamedParametersForMethodCall() {
|
||||
doVariantableTest("abx", "aby");
|
||||
}
|
||||
|
||||
public void testNamedParameters1() throws Throwable {
|
||||
public void testNamedParameters1() {
|
||||
doVariantableTest("abx", "aby");
|
||||
}
|
||||
|
||||
public void testNamedParameters2() throws Throwable {
|
||||
public void testNamedParameters2() {
|
||||
doVariantableTest("abx", "aby");
|
||||
}
|
||||
|
||||
public void testNamedParametersInMap1() throws Throwable {
|
||||
public void testNamedParametersInMap1() {
|
||||
doVariantableTest("abx", "aby");
|
||||
}
|
||||
|
||||
public void testNamedParametersInMap2() throws Throwable {
|
||||
public void testNamedParametersInMap2() {
|
||||
doVariantableTest("abx", "aby");
|
||||
}
|
||||
|
||||
public void testNamedParametersInSecondMap1() throws Throwable {
|
||||
public void testNamedParametersInSecondMap1() {
|
||||
doVariantableTest();
|
||||
}
|
||||
|
||||
public void testNamedParametersInSecondMap2() throws Throwable {
|
||||
public void testNamedParametersInSecondMap2() {
|
||||
doVariantableTest();
|
||||
}
|
||||
|
||||
public void testNamedParametersExcludeExisted() throws Throwable {
|
||||
public void testNamedParametersExcludeExisted() {
|
||||
doVariantableTest("abx", "aby");
|
||||
}
|
||||
|
||||
public void testNamedParametersExcludeExisted2() throws Throwable {
|
||||
public void testNamedParametersExcludeExisted2() {
|
||||
doVariantableTest("abx", "aby", "abz");
|
||||
}
|
||||
|
||||
public void testNamedParametersExcludeExistedMap() throws Throwable {
|
||||
public void testNamedParametersExcludeExistedMap() {
|
||||
doVariantableTest("abx", "aby");
|
||||
}
|
||||
|
||||
public void testNamedParametersForNotMap() throws Throwable {
|
||||
public void testNamedParametersForNotMap() {
|
||||
doBasicTest();
|
||||
}
|
||||
|
||||
public void testNamedParametersForConstructorCall() throws Throwable {
|
||||
public void testNamedParametersForConstructorCall() {
|
||||
doVariantableTest("hahaha", "hohoho", "hashCode");
|
||||
}
|
||||
|
||||
public void testUnfinishedMethodTypeParameter() throws Throwable {
|
||||
public void testUnfinishedMethodTypeParameter() {
|
||||
doVariantableTest("MyParameter", "MySecondParameter");
|
||||
}
|
||||
|
||||
public void testUnfinishedMethodTypeParameter2() throws Throwable {
|
||||
public void testUnfinishedMethodTypeParameter2() {
|
||||
doVariantableTest("MyParameter", "MySecondParameter");
|
||||
}
|
||||
|
||||
public void testInstanceofHelpsDetermineType() throws Throwable {
|
||||
public void testInstanceofHelpsDetermineType() {
|
||||
doBasicTest();
|
||||
}
|
||||
|
||||
public void testInstanceofHelpsDetermineTypeInBinaryAnd() throws Throwable { doBasicTest() }
|
||||
public void testInstanceofHelpsDetermineTypeInBinaryOr() throws Throwable { doBasicTest() }
|
||||
public void testInstanceofHelpsDetermineTypeInBinaryAnd() { doBasicTest() }
|
||||
public void testInstanceofHelpsDetermineTypeInBinaryOr() { doBasicTest() }
|
||||
|
||||
public void testNotInstanceofDoesntHelpDetermineType() throws Throwable {
|
||||
public void testNotInstanceofDoesntHelpDetermineType() {
|
||||
myFixture.testCompletion(getTestName(false) + ".groovy", getTestName(false) + ".groovy");
|
||||
}
|
||||
|
||||
public void testNotInstanceofDoesntHelpDetermineType2() throws Throwable {
|
||||
public void testNotInstanceofDoesntHelpDetermineType2() {
|
||||
myFixture.testCompletion(getTestName(false) + ".groovy", getTestName(false) + ".groovy");
|
||||
}
|
||||
|
||||
public void testTypeParameterCompletion() throws Throwable {
|
||||
public void testTypeParameterCompletion() {
|
||||
myFixture.testCompletionVariants(getTestName(false) + ".groovy", "put", "putAll");
|
||||
}
|
||||
|
||||
public void testCatchClauseParameter() throws Throwable {
|
||||
public void testCatchClauseParameter() {
|
||||
myFixture.testCompletionVariants(getTestName(false) + ".groovy", "getCause", "getClass");
|
||||
}
|
||||
|
||||
public void testFieldSuggestedOnce1() throws Throwable {
|
||||
public void testFieldSuggestedOnce1() {
|
||||
myFixture.testCompletion(getTestName(false) + ".groovy", getTestName(false) + ".groovy");
|
||||
assertNull(myFixture.getLookupElements());
|
||||
}
|
||||
|
||||
public void testFieldSuggestedOnce2() throws Throwable {
|
||||
public void testFieldSuggestedOnce2() {
|
||||
myFixture.testCompletion(getTestName(false) + ".groovy", getTestName(false) + ".groovy");
|
||||
assertNull(myFixture.getLookupElements());
|
||||
}
|
||||
|
||||
public void testFieldSuggestedOnce3() throws Throwable {
|
||||
public void testFieldSuggestedOnce3() {
|
||||
myFixture.testCompletion(getTestName(false) + ".groovy", getTestName(false) + ".groovy");
|
||||
assertNull(myFixture.getLookupElements());
|
||||
}
|
||||
|
||||
public void testFieldSuggestedOnce4() throws Throwable {
|
||||
public void testFieldSuggestedOnce4() {
|
||||
myFixture.testCompletion(getTestName(false) + ".groovy", getTestName(false) + ".groovy");
|
||||
assertNull(myFixture.getLookupElements());
|
||||
}
|
||||
|
||||
public void testFieldSuggestedOnce5() throws Throwable {
|
||||
public void testFieldSuggestedOnce5() {
|
||||
myFixture.testCompletion(getTestName(false) + ".groovy", getTestName(false) + ".groovy");
|
||||
assertNull(myFixture.getLookupElements());
|
||||
}
|
||||
|
||||
public void testFieldSuggestedInMethodCall() throws Throwable {
|
||||
public void testFieldSuggestedInMethodCall() {
|
||||
myFixture.testCompletion(getTestName(false) + ".groovy", getTestName(false) + "_after.groovy");
|
||||
}
|
||||
|
||||
public void testMethodParameterNoSpace() throws Throwable {
|
||||
public void testMethodParameterNoSpace() {
|
||||
myFixture.testCompletion(getTestName(false) + ".groovy", getTestName(false) + "_after.groovy");
|
||||
}
|
||||
|
||||
public void testGroovyDocParameter() throws Throwable {
|
||||
public void testGroovyDocParameter() {
|
||||
myFixture.testCompletionVariants(getTestName(false) + ".groovy", "xx", "xy");
|
||||
}
|
||||
|
||||
public void testInnerClassExtendsImplementsCompletion() throws Throwable {
|
||||
public void testInnerClassExtendsImplementsCompletion() {
|
||||
myFixture.testCompletionVariants(getTestName(false) + ".groovy", "extends", "implements");
|
||||
}
|
||||
|
||||
public void testInnerClassCompletion() throws Throwable {
|
||||
public void testInnerClassCompletion() {
|
||||
myFixture.testCompletionVariants(getTestName(false) + ".groovy", "Inner1", "Inner2");
|
||||
}
|
||||
|
||||
public void testQualifiedThisCompletion() throws Throwable {
|
||||
public void testQualifiedThisCompletion() {
|
||||
myFixture.testCompletionVariants(getTestName(false) + ".groovy", "foo1", "foo2");
|
||||
}
|
||||
|
||||
public void testQualifiedSuperCompletion() throws Throwable {
|
||||
public void testQualifiedSuperCompletion() {
|
||||
myFixture.testCompletionVariants(getTestName(false) + ".groovy", "foo1", "foo2");
|
||||
}
|
||||
|
||||
public void testThisKeywordCompletionAfterClassName1() throws Throwable {
|
||||
public void testThisKeywordCompletionAfterClassName1() {
|
||||
doBasicTest();
|
||||
}
|
||||
|
||||
public void testThisKeywordCompletionAfterClassName2() throws Throwable {
|
||||
public void testThisKeywordCompletionAfterClassName2() {
|
||||
doBasicTest();
|
||||
}
|
||||
|
||||
public void testWhileInstanceof() throws Throwable { doBasicTest() }
|
||||
public void testWhileInstanceof() { doBasicTest() }
|
||||
|
||||
public void testCompletionInParameterListInClosableBlock() throws Throwable { doBasicTest(); }
|
||||
public void testCompletionInParameterListInClosableBlock3() throws Throwable { doBasicTest(); }
|
||||
public void testCompletionInParameterListInClosableBlock() { doBasicTest(); }
|
||||
public void testCompletionInParameterListInClosableBlock3() { doBasicTest(); }
|
||||
|
||||
public void testCompletionInParameterListInClosableBlock2() throws Throwable {
|
||||
public void testCompletionInParameterListInClosableBlock2() {
|
||||
myFixture.testCompletionVariants(getTestName(false) + ".groovy", "aDouble");
|
||||
}
|
||||
|
||||
public void testStaticMemberFromInstanceContext() throws Throwable {
|
||||
public void testStaticMemberFromInstanceContext() {
|
||||
myFixture.testCompletionVariants(getTestName(false) + ".groovy", "var1", "var2");
|
||||
}
|
||||
|
||||
public void testInstanceMemberFromStaticContext() throws Throwable {
|
||||
public void testInstanceMemberFromStaticContext() {
|
||||
myFixture.testCompletionVariants(getTestName(false) + ".groovy", "var3", "var4");
|
||||
}
|
||||
|
||||
public void testTypeCompletionInVariableDeclaration1() throws Throwable {
|
||||
public void testTypeCompletionInVariableDeclaration1() {
|
||||
doBasicTest();
|
||||
}
|
||||
|
||||
public void testTypeCompletionInVariableDeclaration2() throws Throwable {
|
||||
public void testTypeCompletionInVariableDeclaration2() {
|
||||
doBasicTest();
|
||||
}
|
||||
|
||||
public void testTypeCompletionInParameter() throws Throwable {
|
||||
public void testTypeCompletionInParameter() {
|
||||
doBasicTest();
|
||||
}
|
||||
|
||||
public void testGStringConcatenationCompletion() throws Throwable {
|
||||
public void testGStringConcatenationCompletion() {
|
||||
myFixture.testCompletionVariants(getTestName(false) + ".groovy", "substring", "substring", "subSequence");
|
||||
}
|
||||
|
||||
public void testPropertyWithSecondUpperLetter() throws Exception {
|
||||
public void testPropertyWithSecondUpperLetter() {
|
||||
myFixture.testCompletionVariants(getTestName(false) + ".groovy", "geteMail", "getePost");
|
||||
}
|
||||
|
||||
public void testInferredVariableType() throws Exception {
|
||||
public void testInferredVariableType() {
|
||||
myFixture.configureByText "a.groovy", "def foo = 'xxx'; fo<caret>"
|
||||
def presentation = new LookupElementPresentation()
|
||||
myFixture.completeBasic()[0].renderElement(presentation)
|
||||
@@ -236,7 +236,7 @@ public class GroovyCompletionTest extends GroovyCompletionTestBase {
|
||||
assert presentation.typeText == 'String'
|
||||
}
|
||||
|
||||
public void testSubstitutedMethodType() throws Exception {
|
||||
public void testSubstitutedMethodType() {
|
||||
myFixture.configureByText "a.groovy", "new HashMap<String, Integer>().put<caret>x"
|
||||
def presentation = new LookupElementPresentation()
|
||||
myFixture.completeBasic()[0].renderElement(presentation)
|
||||
@@ -248,7 +248,7 @@ public class GroovyCompletionTest extends GroovyCompletionTestBase {
|
||||
public void testIntCompletionInPlusMethod() {doBasicTest();}
|
||||
public void testIntCompletionInGenericParameter() {doBasicTest();}
|
||||
|
||||
public void testWhenSiblingIsStaticallyImported_Method() throws Exception {
|
||||
public void testWhenSiblingIsStaticallyImported_Method() {
|
||||
myFixture.addFileToProject "foo/Foo.groovy", """package foo
|
||||
class Foo {
|
||||
static def abcMethod() {}
|
||||
@@ -272,7 +272,7 @@ public class GroovyCompletionTest extends GroovyCompletionTestBase {
|
||||
"""
|
||||
}
|
||||
|
||||
public void testWhenSiblingIsStaticallyImported_Field() throws Exception {
|
||||
public void testWhenSiblingIsStaticallyImported_Field() {
|
||||
myFixture.addFileToProject "foo/Foo.groovy", """package foo
|
||||
class Foo {
|
||||
static def abcField = 4
|
||||
@@ -770,7 +770,7 @@ try {} catch (AbcdException"""
|
||||
myFixture.checkResult "try {} catch (AbcdException<caret> e) {}"
|
||||
}
|
||||
|
||||
public void testTopLevelClassesFromPackaged() throws Throwable {
|
||||
public void testTopLevelClassesFromPackaged() {
|
||||
myFixture.addClass "public class Fooooo {}"
|
||||
final text = "package foo; class Bar { Fooo<caret> }"
|
||||
def file = myFixture.addFileToProject("foo/Bar.groovy", text)
|
||||
@@ -845,17 +845,17 @@ return foo()"""
|
||||
checkCompletion("new Abcd<caret>", '<', "new AbcdClass<<caret>>()")
|
||||
}
|
||||
|
||||
public void testMapKeysUsedInFile() throws Exception {
|
||||
public void testMapKeysUsedInFile() {
|
||||
CodeInsightSettings.instance.COMPLETION_CASE_SENSITIVE = CodeInsightSettings.NONE
|
||||
doVariantableTest 'foo1', 'foo3', 'foo4', 'Foo5', 'Foo7'
|
||||
}
|
||||
|
||||
public void testNoClassesAsMapKeys() throws Exception {
|
||||
public void testNoClassesAsMapKeys() {
|
||||
CodeInsightSettings.instance.COMPLETION_CASE_SENSITIVE = CodeInsightSettings.NONE
|
||||
doVariantableTest()
|
||||
}
|
||||
|
||||
public void testNamedArgsUsedInFile() throws Exception {
|
||||
public void testNamedArgsUsedInFile() {
|
||||
myFixture.configureByFile(getTestName(false) + ".groovy");
|
||||
doVariantableTest 'false', 'foo2', 'float', 'foo1', 'foo3', 'foo4', 'foo5'
|
||||
}
|
||||
@@ -877,7 +877,7 @@ class A {
|
||||
}'''
|
||||
}
|
||||
|
||||
public void testSuperClassProperty() throws Exception {
|
||||
public void testSuperClassProperty() {
|
||||
checkSingleItemCompletion """
|
||||
class A { def foooooooooooo }
|
||||
|
||||
@@ -967,7 +967,7 @@ println "abcd"
|
||||
''')
|
||||
}
|
||||
|
||||
public void testNoModifiersAfterDef() throws Exception {
|
||||
public void testNoModifiersAfterDef() {
|
||||
checkSingleItemCompletion 'def priv<caret>', 'def priv<caret>'
|
||||
}
|
||||
|
||||
@@ -1079,19 +1079,19 @@ class X {
|
||||
checkCompletion 'byte v1 = (by<caret>te) 0', '\t', 'byte v1 = (byte<caret>) 0'
|
||||
}
|
||||
|
||||
public void testInitializerMatters() throws Exception {
|
||||
public void testInitializerMatters() {
|
||||
myFixture.configureByText("a.groovy", "class Foo {{ String f<caret>x = getFoo(); }; String getFoo() {}; }");
|
||||
myFixture.completeBasic()
|
||||
assertOrderedEquals(myFixture.lookupElementStrings, ["foo"])
|
||||
}
|
||||
|
||||
public void testFieldInitializerMatters() throws Exception {
|
||||
public void testFieldInitializerMatters() {
|
||||
myFixture.configureByText("a.groovy", "class Foo { String f<caret>x = getFoo(); String getFoo() {}; }");
|
||||
myFixture.completeBasic()
|
||||
assertOrderedEquals(myFixture.lookupElementStrings, ["foo"])
|
||||
}
|
||||
|
||||
public void testAccessStaticViaInstanceSecond() throws Exception {
|
||||
public void testAccessStaticViaInstanceSecond() {
|
||||
myFixture.configureByText("a.groovy", """
|
||||
public class KeyVO {
|
||||
{ this.fo<caret>x }
|
||||
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright 2000-2007 JetBrains s.r.o.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.plugins.groovy.completion
|
||||
|
||||
import org.jetbrains.plugins.groovy.util.TestUtils
|
||||
|
||||
/**
|
||||
* @author ilyas
|
||||
*/
|
||||
public class KeywordCompletionTest extends CompletionTestBase {
|
||||
|
||||
void testBr1() { doTest() }
|
||||
void testCase_return() { doTest() }
|
||||
void testClass1() { doTest() }
|
||||
void testClass2() { doTest() }
|
||||
void testClass3() { doTest() }
|
||||
void testClass4() { doTest() }
|
||||
void testExpr1() { doTest() }
|
||||
void testExpr2() { doTest() }
|
||||
void testFile11() { doTest() }
|
||||
void testFile12() { doTest() }
|
||||
void testFin() { doTest() }
|
||||
void testFin2() { doTest() }
|
||||
void testGRVY1064() { doTest() }
|
||||
void testGrvy1404() { doTest() }
|
||||
void testImp1() { doTest() }
|
||||
void testImp2() { doTest() }
|
||||
void testImp3() { doTest() }
|
||||
void _testImp4() { doTest() }
|
||||
void testIns1() { doTest() }
|
||||
void testIns2() { doTest() }
|
||||
void testIns3() { doTest() }
|
||||
void testInt1() { doTest() }
|
||||
void testLocal1() { doTest() }
|
||||
void testMod1() { doTest() }
|
||||
void testMod10() { doTest() }
|
||||
void testMod11() { doTest() }
|
||||
void testMod2() { doTest() }
|
||||
void testMod3() { doTest() }
|
||||
void testMod4() { doTest() }
|
||||
void testMod5() { doTest() }
|
||||
void testMod6() { doTest() }
|
||||
void testMod7() { doTest() }
|
||||
void testMod8() { doTest() }
|
||||
void testMod9() { doTest() }
|
||||
void testPack1() { doTest() }
|
||||
void testSt1() { doTest() }
|
||||
void testSwit1() { doTest() }
|
||||
void testSwit13() { doTest() }
|
||||
void testSwit14() { doTest() }
|
||||
void testSwit2() { doTest() }
|
||||
void testSwit3() { doTest() }
|
||||
void testSwit4() { doTest() }
|
||||
void testSwit5() { doTest() }
|
||||
void testTag1() { doTest() }
|
||||
void testTag2() { doTest() }
|
||||
void testTag3() { doTest() }
|
||||
void testTag4() { doTest() }
|
||||
void testTh1() { doTest() }
|
||||
void testTh2() { doTest() }
|
||||
void testVar1() { doTest() }
|
||||
void testVar10() { doTest() }
|
||||
void testVar13() { doTest() }
|
||||
void testVar2() { doTest() }
|
||||
void testVar3() { doTest() }
|
||||
void testVar4() { doTest() }
|
||||
void testVar5() { doTest() }
|
||||
void testVar6() { doTest() }
|
||||
void testVar7() { doTest() }
|
||||
void testVar8() { doTest() }
|
||||
void testWhile55() { doTest() }
|
||||
void testDefInsideCase() { doTest() }
|
||||
void testThrows1() { doTest() }
|
||||
void testThrows2() { doTest() }
|
||||
void testThrows3() { doTest() }
|
||||
void testPrimitiveTypes() { doTest() }
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
"${TestUtils.testDataPath}groovy/oldCompletion/keyword"
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean addReferenceVariants() {
|
||||
false
|
||||
}
|
||||
|
||||
}
|
||||
-98
@@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2007 JetBrains s.r.o.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.plugins.groovy.completion;
|
||||
|
||||
import org.jetbrains.plugins.groovy.util.TestUtils;
|
||||
|
||||
/**
|
||||
* @author ilyas
|
||||
*/
|
||||
public class KeywordCompletionTest extends CompletionTestBase {
|
||||
|
||||
public void testBr1() throws Throwable { doTest(); }
|
||||
public void testCase_return() throws Throwable { doTest(); }
|
||||
public void testClass1() throws Throwable { doTest(); }
|
||||
public void testClass2() throws Throwable { doTest(); }
|
||||
public void testClass3() throws Throwable { doTest(); }
|
||||
public void testClass4() throws Throwable { doTest(); }
|
||||
public void testExpr1() throws Throwable { doTest(); }
|
||||
public void testExpr2() throws Throwable { doTest(); }
|
||||
public void testFile11() throws Throwable { doTest(); }
|
||||
public void testFile12() throws Throwable { doTest(); }
|
||||
public void testFin() throws Throwable { doTest(); }
|
||||
public void testFin2() throws Throwable { doTest(); }
|
||||
public void testGRVY1064() throws Throwable { doTest(); }
|
||||
public void testGrvy1404() throws Throwable { doTest(); }
|
||||
public void testImp1() throws Throwable { doTest(); }
|
||||
public void testImp2() throws Throwable { doTest(); }
|
||||
public void testImp3() throws Throwable { doTest(); }
|
||||
public void testImp4() throws Throwable { doTest(); }
|
||||
public void testIns1() throws Throwable { doTest(); }
|
||||
public void testIns2() throws Throwable { doTest(); }
|
||||
public void testIns3() throws Throwable { doTest(); }
|
||||
public void testInt1() throws Throwable { doTest(); }
|
||||
public void testLocal1() throws Throwable { doTest(); }
|
||||
public void testMod1() throws Throwable { doTest(); }
|
||||
public void testMod10() throws Throwable { doTest(); }
|
||||
public void testMod11() throws Throwable { doTest(); }
|
||||
public void testMod2() throws Throwable { doTest(); }
|
||||
public void testMod3() throws Throwable { doTest(); }
|
||||
public void testMod4() throws Throwable { doTest(); }
|
||||
public void testMod5() throws Throwable { doTest(); }
|
||||
public void testMod6() throws Throwable { doTest(); }
|
||||
public void testMod7() throws Throwable { doTest(); }
|
||||
public void testMod8() throws Throwable { doTest(); }
|
||||
public void testMod9() throws Throwable { doTest(); }
|
||||
public void testPack1() throws Throwable { doTest(); }
|
||||
public void testSt1() throws Throwable { doTest(); }
|
||||
public void testSwit1() throws Throwable { doTest(); }
|
||||
public void testSwit13() throws Throwable { doTest(); }
|
||||
public void testSwit14() throws Throwable { doTest(); }
|
||||
public void testSwit2() throws Throwable { doTest(); }
|
||||
public void testSwit3() throws Throwable { doTest(); }
|
||||
public void testSwit4() throws Throwable { doTest(); }
|
||||
public void testSwit5() throws Throwable { doTest(); }
|
||||
public void testTag1() throws Throwable { doTest(); }
|
||||
public void testTag2() throws Throwable { doTest(); }
|
||||
public void testTag3() throws Throwable { doTest(); }
|
||||
public void testTag4() throws Throwable { doTest(); }
|
||||
public void testTh1() throws Throwable { doTest(); }
|
||||
public void testTh2() throws Throwable { doTest(); }
|
||||
public void testVar1() throws Throwable { doTest(); }
|
||||
public void testVar10() throws Throwable { doTest(); }
|
||||
public void testVar13() throws Throwable { doTest(); }
|
||||
public void testVar2() throws Throwable { doTest(); }
|
||||
public void testVar3() throws Throwable { doTest(); }
|
||||
public void testVar4() throws Throwable { doTest(); }
|
||||
public void testVar5() throws Throwable { doTest(); }
|
||||
public void testVar6() throws Throwable { doTest(); }
|
||||
public void testVar7() throws Throwable { doTest(); }
|
||||
public void testVar8() throws Throwable { doTest(); }
|
||||
public void testWhile55() throws Throwable { doTest(); }
|
||||
public void testDefInsideCase() throws Throwable { doTest(); }
|
||||
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return TestUtils.getTestDataPath() + "groovy/oldCompletion/keyword";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean addReferenceVariants() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
-5
@@ -54,11 +54,6 @@ public class ReferenceCompletionTest extends CompletionTestBase {
|
||||
return TestUtils.getTestDataPath() + "groovy/oldCompletion/reference";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean addKeywords() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tuneFixture(JavaModuleFixtureBuilder moduleBuilder) {
|
||||
moduleBuilder.addJdk(TestUtils.getMockJdkHome());
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
import static <caret> a.b
|
||||
-----
|
||||
META-INF
|
||||
java
|
||||
javax
|
||||
org
|
||||
@@ -0,0 +1,31 @@
|
||||
class X {
|
||||
def foo()
|
||||
|
||||
<caret>
|
||||
}
|
||||
-----
|
||||
abstract
|
||||
boolean
|
||||
byte
|
||||
char
|
||||
class
|
||||
def
|
||||
double
|
||||
enum
|
||||
final
|
||||
float
|
||||
int
|
||||
interface
|
||||
long
|
||||
native
|
||||
private
|
||||
protected
|
||||
public
|
||||
short
|
||||
static
|
||||
strictfp
|
||||
synchronized
|
||||
throws
|
||||
transient
|
||||
void
|
||||
volatile
|
||||
@@ -2,4 +2,7 @@ class A{
|
||||
static A() <caret>
|
||||
}
|
||||
-----
|
||||
class
|
||||
enum
|
||||
interface
|
||||
throws
|
||||
@@ -0,0 +1,5 @@
|
||||
class X {
|
||||
def foo() th<caret>
|
||||
}
|
||||
-----
|
||||
throws
|
||||
@@ -0,0 +1,5 @@
|
||||
class X {
|
||||
def foo() th<caret> {}
|
||||
}
|
||||
-----
|
||||
throws
|
||||
@@ -0,0 +1,4 @@
|
||||
class X {
|
||||
def foo(); th<caret>
|
||||
}
|
||||
-----
|
||||
@@ -11,7 +11,6 @@ class A {
|
||||
<caret>
|
||||
}
|
||||
-----
|
||||
META-INF
|
||||
abstract
|
||||
boolean
|
||||
byte
|
||||
@@ -24,11 +23,8 @@ final
|
||||
float
|
||||
int
|
||||
interface
|
||||
java
|
||||
javax
|
||||
long
|
||||
native
|
||||
org
|
||||
private
|
||||
protected
|
||||
public
|
||||
|
||||
@@ -10,8 +10,4 @@ class A {
|
||||
}
|
||||
}
|
||||
-----
|
||||
META-INF
|
||||
java
|
||||
javax
|
||||
org
|
||||
static
|
||||
@@ -10,7 +10,6 @@ class A { <caret>
|
||||
}
|
||||
}
|
||||
-----
|
||||
META-INF
|
||||
abstract
|
||||
boolean
|
||||
byte
|
||||
@@ -23,11 +22,8 @@ final
|
||||
float
|
||||
int
|
||||
interface
|
||||
java
|
||||
javax
|
||||
long
|
||||
native
|
||||
org
|
||||
private
|
||||
protected
|
||||
public
|
||||
|
||||
Reference in New Issue
Block a user