IDEA-88549 Auto completion makes it hard to add constructor with int parameter

This commit is contained in:
Maxim.Medvedev
2012-07-29 19:39:15 +04:00
parent 156ad7c75a
commit 8c4504637d
6 changed files with 116 additions and 112 deletions
@@ -51,15 +51,16 @@ public class ConstructorDefinition implements GroovyElementTypes {
}
if (!ParserUtils.getToken(builder, mLPAREN)) {
builder.error(GroovyBundle.message("lparen.expected"));
constructorMarker.rollbackTo();
return false;
}
ParameterList.parse(builder, mRPAREN, parser);
ParserUtils.getToken(builder, mNLS);
if (!ParserUtils.getToken(builder, mRPAREN)) {
constructorMarker.rollbackTo();
return false;
constructorMarker.done(CONSTRUCTOR_DEFINITION);
return true;
}
if (ParserUtils.lookAhead(builder, mNLS, kTHROWS) || ParserUtils.lookAhead(builder, mNLS, mLCURLY)) {
@@ -71,12 +72,9 @@ public class ConstructorDefinition implements GroovyElementTypes {
if (builder.getTokenType() == mLCURLY || ParserUtils.lookAhead(builder, mNLS, mLCURLY)) {
ParserUtils.getToken(builder, mNLS);
ConstructorBody.parseConstructorBody(builder, parser);
constructorMarker.done(CONSTRUCTOR_DEFINITION);
return true;
}
constructorMarker.rollbackTo();
return false;
constructorMarker.done(CONSTRUCTOR_DEFINITION);
return true;
}
private static boolean parseModifiers(PsiBuilder builder, GroovyParser parser) {
@@ -1,101 +1,102 @@
/*
* 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
}
}
/*
* 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() }
void testIncompleteConstructor() { doTest() }
@Override
protected String getBasePath() {
"${TestUtils.testDataPath}groovy/oldCompletion/keyword"
}
@Override
protected boolean addReferenceVariants() {
false
}
}
@@ -0,0 +1,5 @@
class Foo {
Foo(int<caret>
}
-----
int
@@ -13,7 +13,7 @@ Groovy script
Type definition body
PsiElement({)('{')
PsiWhiteSpace('\n ')
Method
Constructor
Modifiers
PsiElement(def)('def')
PsiWhiteSpace(' ')
@@ -16,7 +16,7 @@ Groovy script
Type definition body
PsiElement({)('{')
PsiWhiteSpace('\n ')
Method
Constructor
Modifiers
PsiElement(def)('def')
PsiWhiteSpace(' ')
@@ -13,7 +13,7 @@ Groovy script
Type definition body
PsiElement({)('{')
PsiWhiteSpace('\n ')
Method
Constructor
Modifiers
PsiElement(def)('def')
PsiWhiteSpace(' ')