From 69a47cde5f6fccdc84b4aa7ea4594730a1760f76 Mon Sep 17 00:00:00 2001 From: "Maxim.Medvedev" Date: Thu, 28 Jun 2012 11:23:23 +0400 Subject: [PATCH] compete 'class' after abstract method --- .../groovy/annotator/KeywordHighlighter.java | 3 +- .../lang/completion/GroovyCompletionData.java | 21 ++- .../plugins/groovy/lang/psi/util/PsiUtil.java | 1 + .../groovy/completion/CompletionTestBase.java | 11 +- .../completion/GroovyCompletionTest.groovy | 124 +++++++++--------- .../completion/KeywordCompletionTest.groovy | 101 ++++++++++++++ .../completion/KeywordCompletionTest.java | 98 -------------- .../completion/ReferenceCompletionTest.java | 5 - .../groovy/oldCompletion/keyword/imp4.test | 6 - .../oldCompletion/keyword/primitiveTypes.test | 31 +++++ .../groovy/oldCompletion/keyword/th2.test | 3 + .../groovy/oldCompletion/keyword/throws1.test | 5 + .../groovy/oldCompletion/keyword/throws2.test | 5 + .../groovy/oldCompletion/keyword/throws3.test | 4 + .../groovy/oldCompletion/keyword/var13.test | 4 - .../groovy/oldCompletion/keyword/var3.test | 4 - .../groovy/oldCompletion/keyword/var6.test | 4 - 17 files changed, 231 insertions(+), 199 deletions(-) create mode 100644 plugins/groovy/test/org/jetbrains/plugins/groovy/completion/KeywordCompletionTest.groovy delete mode 100644 plugins/groovy/test/org/jetbrains/plugins/groovy/completion/KeywordCompletionTest.java delete mode 100644 plugins/groovy/testdata/groovy/oldCompletion/keyword/imp4.test create mode 100644 plugins/groovy/testdata/groovy/oldCompletion/keyword/primitiveTypes.test create mode 100644 plugins/groovy/testdata/groovy/oldCompletion/keyword/throws1.test create mode 100644 plugins/groovy/testdata/groovy/oldCompletion/keyword/throws2.test create mode 100644 plugins/groovy/testdata/groovy/oldCompletion/keyword/throws3.test diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/KeywordHighlighter.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/KeywordHighlighter.java index 600c86638322..d85d33019656 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/KeywordHighlighter.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/KeywordHighlighter.java @@ -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()); } } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionData.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionData.java index 0acf10d4bdf0..2502a7209cd0 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionData.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionData.java @@ -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; diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java index 7f5c771938c8..05b52822d5c9 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/util/PsiUtil.java @@ -828,6 +828,7 @@ public class PsiUtil { return place == clazz; } + @Nullable public static PsiElement skipWhitespaces(@Nullable PsiElement elem, boolean forward) { //noinspection ConstantConditions diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/CompletionTestBase.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/CompletionTestBase.java index 7e6cfad36fd4..1d0fedb0483b 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/CompletionTestBase.java +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/CompletionTestBase.java @@ -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 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; } diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovyCompletionTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovyCompletionTest.groovy index 95988ee2fb87..d84a161f0306 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovyCompletionTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/GroovyCompletionTest.groovy @@ -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" 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().putx" 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 e) {}" } - public void testTopLevelClassesFromPackaged() throws Throwable { + public void testTopLevelClassesFromPackaged() { myFixture.addClass "public class Fooooo {}" final text = "package foo; class Bar { Fooo }" def file = myFixture.addFileToProject("foo/Bar.groovy", text) @@ -845,17 +845,17 @@ return foo()""" checkCompletion("new Abcd", '<', "new AbcdClass<>()") } - 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', 'def priv' } @@ -1079,19 +1079,19 @@ class X { checkCompletion 'byte v1 = (byte) 0', '\t', 'byte v1 = (byte) 0' } - public void testInitializerMatters() throws Exception { + public void testInitializerMatters() { myFixture.configureByText("a.groovy", "class Foo {{ String fx = getFoo(); }; String getFoo() {}; }"); myFixture.completeBasic() assertOrderedEquals(myFixture.lookupElementStrings, ["foo"]) } - public void testFieldInitializerMatters() throws Exception { + public void testFieldInitializerMatters() { myFixture.configureByText("a.groovy", "class Foo { String fx = 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.fox } diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/KeywordCompletionTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/KeywordCompletionTest.groovy new file mode 100644 index 000000000000..6e67ddc63c93 --- /dev/null +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/KeywordCompletionTest.groovy @@ -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 + } + +} diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/KeywordCompletionTest.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/KeywordCompletionTest.java deleted file mode 100644 index bcb21b00bf34..000000000000 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/KeywordCompletionTest.java +++ /dev/null @@ -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; - } - -} diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/ReferenceCompletionTest.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/ReferenceCompletionTest.java index 388bc568d68d..30eaebab80ef 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/ReferenceCompletionTest.java +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/ReferenceCompletionTest.java @@ -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()); diff --git a/plugins/groovy/testdata/groovy/oldCompletion/keyword/imp4.test b/plugins/groovy/testdata/groovy/oldCompletion/keyword/imp4.test deleted file mode 100644 index 35f7f2ff4ddb..000000000000 --- a/plugins/groovy/testdata/groovy/oldCompletion/keyword/imp4.test +++ /dev/null @@ -1,6 +0,0 @@ -import static a.b ------ -META-INF -java -javax -org \ No newline at end of file diff --git a/plugins/groovy/testdata/groovy/oldCompletion/keyword/primitiveTypes.test b/plugins/groovy/testdata/groovy/oldCompletion/keyword/primitiveTypes.test new file mode 100644 index 000000000000..7b24b36202ad --- /dev/null +++ b/plugins/groovy/testdata/groovy/oldCompletion/keyword/primitiveTypes.test @@ -0,0 +1,31 @@ +class X { + def foo() + + +} +----- +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 \ No newline at end of file diff --git a/plugins/groovy/testdata/groovy/oldCompletion/keyword/th2.test b/plugins/groovy/testdata/groovy/oldCompletion/keyword/th2.test index f6c5113fc213..1933b4acca81 100644 --- a/plugins/groovy/testdata/groovy/oldCompletion/keyword/th2.test +++ b/plugins/groovy/testdata/groovy/oldCompletion/keyword/th2.test @@ -2,4 +2,7 @@ class A{ static A() } ----- +class +enum +interface throws \ No newline at end of file diff --git a/plugins/groovy/testdata/groovy/oldCompletion/keyword/throws1.test b/plugins/groovy/testdata/groovy/oldCompletion/keyword/throws1.test new file mode 100644 index 000000000000..3edcd11e7e4c --- /dev/null +++ b/plugins/groovy/testdata/groovy/oldCompletion/keyword/throws1.test @@ -0,0 +1,5 @@ +class X { + def foo() th +} +----- +throws \ No newline at end of file diff --git a/plugins/groovy/testdata/groovy/oldCompletion/keyword/throws2.test b/plugins/groovy/testdata/groovy/oldCompletion/keyword/throws2.test new file mode 100644 index 000000000000..93cc2df97b50 --- /dev/null +++ b/plugins/groovy/testdata/groovy/oldCompletion/keyword/throws2.test @@ -0,0 +1,5 @@ +class X { + def foo() th {} +} +----- +throws \ No newline at end of file diff --git a/plugins/groovy/testdata/groovy/oldCompletion/keyword/throws3.test b/plugins/groovy/testdata/groovy/oldCompletion/keyword/throws3.test new file mode 100644 index 000000000000..a843e28284dd --- /dev/null +++ b/plugins/groovy/testdata/groovy/oldCompletion/keyword/throws3.test @@ -0,0 +1,4 @@ +class X { + def foo(); th +} +----- diff --git a/plugins/groovy/testdata/groovy/oldCompletion/keyword/var13.test b/plugins/groovy/testdata/groovy/oldCompletion/keyword/var13.test index 58151b4ec46d..72f1e3bece98 100644 --- a/plugins/groovy/testdata/groovy/oldCompletion/keyword/var13.test +++ b/plugins/groovy/testdata/groovy/oldCompletion/keyword/var13.test @@ -11,7 +11,6 @@ class A { } ----- -META-INF abstract boolean byte @@ -24,11 +23,8 @@ final float int interface -java -javax long native -org private protected public diff --git a/plugins/groovy/testdata/groovy/oldCompletion/keyword/var3.test b/plugins/groovy/testdata/groovy/oldCompletion/keyword/var3.test index d77d173b6cc5..c26b3e8a7eb4 100644 --- a/plugins/groovy/testdata/groovy/oldCompletion/keyword/var3.test +++ b/plugins/groovy/testdata/groovy/oldCompletion/keyword/var3.test @@ -10,8 +10,4 @@ class A { } } ----- -META-INF -java -javax -org static \ No newline at end of file diff --git a/plugins/groovy/testdata/groovy/oldCompletion/keyword/var6.test b/plugins/groovy/testdata/groovy/oldCompletion/keyword/var6.test index 53edfa257c61..923580443c31 100644 --- a/plugins/groovy/testdata/groovy/oldCompletion/keyword/var6.test +++ b/plugins/groovy/testdata/groovy/oldCompletion/keyword/var6.test @@ -10,7 +10,6 @@ class A { } } ----- -META-INF abstract boolean byte @@ -23,11 +22,8 @@ final float int interface -java -javax long native -org private protected public