mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
a cheaper groovy stub element type holder
This commit is contained in:
+1
-1
@@ -86,6 +86,6 @@ public class GroovyChangeUtilSupport implements TreeCopyHandler {
|
||||
while (node != null && node.getElementType() == GroovyElementTypes.REFERENCE_ELEMENT) {
|
||||
node = node.getTreeParent();
|
||||
}
|
||||
return node != null && node.getElementType() == GroovyElementTypes.IMPORT_STATEMENT;
|
||||
return node != null && node.getElementType() == GroovyElementTypes.IMPORT;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -122,7 +122,7 @@ public class GroovyFoldingBuilder extends CustomFoldingBuilder implements DumbAw
|
||||
IElementType type = node.getElementType();
|
||||
JavaCodeFoldingSettings settings = JavaCodeFoldingSettings.getInstance();
|
||||
if ((type == GroovyElementTypes.OPEN_BLOCK || type == GroovyElementTypes.CONSTRUCTOR_BODY) && node.getTreeParent().getElementType() ==
|
||||
GroovyElementTypes.METHOD_DEFINITION) {
|
||||
GroovyElementTypes.METHOD) {
|
||||
return settings.isCollapseMethods();
|
||||
}
|
||||
|
||||
@@ -309,6 +309,6 @@ public class GroovyFoldingBuilder extends CustomFoldingBuilder implements DumbAw
|
||||
@Override
|
||||
protected boolean isCustomFoldingRoot(@NotNull ASTNode node) {
|
||||
IElementType nodeType = node.getElementType();
|
||||
return nodeType == GroovyElementTypes.CLASS_DEFINITION || nodeType == GroovyElementTypes.OPEN_BLOCK;
|
||||
return nodeType == GroovyElementTypes.CLASS_TYPE_DEFINITION || nodeType == GroovyElementTypes.OPEN_BLOCK;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -196,18 +196,18 @@ public interface TokenSets {
|
||||
|
||||
TokenSet BLOCK_SET = TokenSet.create(CLOSABLE_BLOCK, BLOCK_STATEMENT, CONSTRUCTOR_BODY, OPEN_BLOCK, ENUM_BODY, CLASS_BODY);
|
||||
|
||||
TokenSet METHOD_DEFS = TokenSet.create(METHOD_DEFINITION, CONSTRUCTOR_DEFINITION, ANNOTATION_METHOD);
|
||||
TokenSet METHOD_DEFS = TokenSet.create(METHOD, CONSTRUCTOR, ANNOTATION_METHOD);
|
||||
|
||||
TokenSet VARIABLES = TokenSet.create(VARIABLE, FIELD);
|
||||
|
||||
TokenSet TYPE_ELEMENTS = TokenSet.create(CLASS_TYPE_ELEMENT, ARRAY_TYPE, BUILT_IN_TYPE, TYPE_ARGUMENT, DISJUNCTION_TYPE_ELEMENT);
|
||||
|
||||
TokenSet TYPE_DEFINITIONS = TokenSet.create(
|
||||
CLASS_DEFINITION,
|
||||
ENUM_DEFINITION,
|
||||
INTERFACE_DEFINITION,
|
||||
ANNOTATION_DEFINITION,
|
||||
TRAIT_DEFINITION
|
||||
CLASS_TYPE_DEFINITION,
|
||||
ENUM_TYPE_DEFINITION,
|
||||
INTERFACE_TYPE_DEFINITION,
|
||||
ANNOTATION_TYPE_DEFINITION,
|
||||
TRAIT_TYPE_DEFINITION
|
||||
);
|
||||
|
||||
TokenSet METHOD_IDENTIFIERS = TokenSet.orSet(GroovyTokenSets.STRING_LITERALS, TokenSet.create(mIDENT));
|
||||
|
||||
+3
-72
@@ -1,25 +1,9 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.plugins.groovy.lang.parser;
|
||||
|
||||
import com.intellij.psi.stubs.EmptyStubElementType;
|
||||
import com.intellij.psi.stubs.IStubElementType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.IStubFileElementType;
|
||||
import org.jetbrains.plugins.groovy.lang.lexer.GroovyElementType;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrThrowsClause;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.GrModifierList;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.annotation.GrAnnotation;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameterList;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.*;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrEnumConstant;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrEnumConstantList;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeParameter;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeParameterList;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.stubs.*;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.stubs.elements.*;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.stubs.elements.GrMethodElementType;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.*;
|
||||
|
||||
@@ -28,32 +12,12 @@ import static org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.*;
|
||||
*
|
||||
* @author Dmitry.Krasilschikov, ilyas
|
||||
*/
|
||||
public interface GroovyElementTypes {
|
||||
public interface GroovyElementTypes extends GroovyStubElementTypes, GroovyEmptyStubElementTypes {
|
||||
|
||||
/*
|
||||
Stub elements
|
||||
*/
|
||||
GrStubElementType<GrTypeDefinitionStub, GrClassDefinition> CLASS_DEFINITION = CLASS_TYPE_DEFINITION;
|
||||
GrStubElementType<GrTypeDefinitionStub, GrInterfaceDefinition> INTERFACE_DEFINITION = INTERFACE_TYPE_DEFINITION;
|
||||
GrStubElementType<GrTypeDefinitionStub, GrEnumTypeDefinition> ENUM_DEFINITION = ENUM_TYPE_DEFINITION;
|
||||
GrStubElementType<GrTypeDefinitionStub, GrAnnotationTypeDefinition> ANNOTATION_DEFINITION = ANNOTATION_TYPE_DEFINITION;
|
||||
GrStubElementType<GrTypeDefinitionStub, GrAnonymousClassDefinition> ANONYMOUS_CLASS_DEFINITION = ANONYMOUS_TYPE_DEFINITION;
|
||||
GrStubElementType<GrTypeDefinitionStub, GrTraitTypeDefinition> TRAIT_DEFINITION = TRAIT_TYPE_DEFINITION;
|
||||
GrStubElementType<GrTypeDefinitionStub, GrEnumConstantInitializer> ENUM_CONSTANT_INITIALIZER = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.ENUM_CONSTANT_INITIALIZER;
|
||||
|
||||
GrStubElementType<GrFieldStub, GrEnumConstant> ENUM_CONSTANT = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.ENUM_CONSTANT;
|
||||
GrStubElementType<GrFieldStub, GrField> FIELD = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.FIELD;
|
||||
@Deprecated
|
||||
GrMethodElementType METHOD_DEFINITION = METHOD;
|
||||
GrStubElementType<GrMethodStub, GrMethod> ANNOTATION_METHOD = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.ANNOTATION_METHOD;
|
||||
|
||||
GrReferenceListElementType<GrImplementsClause> IMPLEMENTS_CLAUSE = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.IMPLEMENTS_CLAUSE;
|
||||
GrReferenceListElementType<GrExtendsClause> EXTENDS_CLAUSE = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.EXTENDS_CLAUSE;
|
||||
|
||||
IElementType NONE = new GroovyElementType("no token"); //not a node
|
||||
|
||||
GroovyElementType LITERAL = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.LITERAL;
|
||||
//Packaging
|
||||
GrPackageDefinitionElementType PACKAGE_DEFINITION = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.PACKAGE_DEFINITION;
|
||||
|
||||
GrCodeBlockElementType CLOSABLE_BLOCK = CLOSURE;
|
||||
GrCodeBlockElementType OPEN_BLOCK = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.OPEN_BLOCK;
|
||||
@@ -61,9 +25,6 @@ public interface GroovyElementTypes {
|
||||
|
||||
IElementType BLOCK_STATEMENT = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.BLOCK_STATEMENT;
|
||||
|
||||
EmptyStubElementType<GrEnumConstantList> ENUM_CONSTANTS = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.ENUM_CONSTANTS;
|
||||
GrImportStatementElementType IMPORT_STATEMENT = IMPORT;
|
||||
|
||||
IElementType ASSERT_STATEMENT = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.ASSERT_STATEMENT;
|
||||
// Expression statements
|
||||
IElementType LABELED_STATEMENT = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.LABELED_STATEMENT;
|
||||
@@ -123,28 +84,7 @@ public interface GroovyElementTypes {
|
||||
|
||||
IElementType TYPE_ARGUMENTS = TYPE_ARGUMENT_LIST;
|
||||
IElementType TYPE_ARGUMENT = WILDCARD_TYPE_ELEMENT;
|
||||
EmptyStubElementType<GrTypeParameterList> TYPE_PARAMETER_LIST = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.TYPE_PARAMETER_LIST;
|
||||
|
||||
GrStubElementType<GrTypeParameterStub, GrTypeParameter> TYPE_PARAMETER = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.TYPE_PARAMETER;
|
||||
|
||||
IStubElementType<GrReferenceListStub, GrReferenceList> TYPE_PARAMETER_EXTENDS_BOUND_LIST = TYPE_PARAMETER_BOUNDS_LIST;
|
||||
|
||||
GrMethodElementType CONSTRUCTOR_DEFINITION = CONSTRUCTOR;
|
||||
|
||||
GrReferenceListElementType<GrThrowsClause> THROW_CLAUSE = THROWS_CLAUSE;
|
||||
//annotation
|
||||
GrAnnotationArgumentListElementType ANNOTATION_ARGUMENTS = ANNOTATION_ARGUMENT_LIST;
|
||||
GrNameValuePairElementType ANNOTATION_MEMBER_VALUE_PAIR = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.ANNOTATION_MEMBER_VALUE_PAIR;
|
||||
|
||||
GrStubElementType<GrAnnotationStub, GrAnnotation> ANNOTATION = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.ANNOTATION;
|
||||
//parameters
|
||||
EmptyStubElementType<GrParameterList> PARAMETERS_LIST = PARAMETER_LIST;
|
||||
|
||||
GrStubElementType<GrParameterStub, GrParameter> PARAMETER = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.PARAMETER;
|
||||
|
||||
EmptyStubElementType<GrTypeDefinitionBody> CLASS_BODY = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.CLASS_BODY;
|
||||
|
||||
EmptyStubElementType<GrEnumDefinitionBody> ENUM_BODY = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.ENUM_BODY;
|
||||
//statements
|
||||
IElementType IF_STATEMENT = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.IF_STATEMENT;
|
||||
IElementType SWITCH_STATEMENT = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.SWITCH_STATEMENT;
|
||||
@@ -158,14 +98,5 @@ public interface GroovyElementTypes {
|
||||
IElementType FINALLY_CLAUSE = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.FINALLY_CLAUSE;
|
||||
IElementType CLASS_INITIALIZER = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.CLASS_INITIALIZER;
|
||||
|
||||
GrVariableDeclarationElementType VARIABLE_DEFINITION = VARIABLE_DECLARATION;
|
||||
GrVariableElementType VARIABLE = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.VARIABLE;
|
||||
|
||||
//modifiers
|
||||
GrStubElementType<GrModifierListStub, GrModifierList> MODIFIERS = MODIFIER_LIST;
|
||||
|
||||
//types
|
||||
IElementType CLASS_TYPE_ELEMENT = org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes.CLASS_TYPE_ELEMENT;
|
||||
|
||||
IStubFileElementType GROOVY_FILE = GroovyParserDefinition.GROOVY_FILE;
|
||||
}
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.plugins.groovy.lang.parser;
|
||||
|
||||
import org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.stubs.elements.*;
|
||||
|
||||
public interface GroovyEmptyStubElementTypes {
|
||||
GrAnnotationArgumentListElementType ANNOTATION_ARGUMENT_LIST = GroovyElementTypes.ANNOTATION_ARGUMENT_LIST;
|
||||
GrEnumConstantListElementType ENUM_CONSTANTS = GroovyElementTypes.ENUM_CONSTANTS;
|
||||
GrTypeParameterListElementType TYPE_PARAMETER_LIST = GroovyElementTypes.TYPE_PARAMETER_LIST;
|
||||
GrParameterListElementType PARAMETER_LIST = GroovyElementTypes.PARAMETER_LIST;
|
||||
GrTypeDefinitionBodyElementType CLASS_BODY = GroovyElementTypes.CLASS_BODY;
|
||||
GrEnumDefinitionBodyElementType ENUM_BODY = GroovyElementTypes.ENUM_BODY;
|
||||
}
|
||||
+1
-1
@@ -102,7 +102,7 @@ public class GroovyParserDefinition implements ParserDefinition {
|
||||
if (rType == GroovyTokenTypes.kIMPORT && lType != TokenType.WHITE_SPACE) {
|
||||
return SpaceRequirements.MUST_LINE_BREAK;
|
||||
}
|
||||
else if (lType == MODIFIERS && rType == MODIFIERS) {
|
||||
else if (lType == MODIFIER_LIST && rType == MODIFIER_LIST) {
|
||||
return SpaceRequirements.MUST;
|
||||
}
|
||||
if (lType == GroovyTokenTypes.mSEMI) {
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.plugins.groovy.lang.parser;
|
||||
|
||||
import org.jetbrains.plugins.groovy.lang.psi.GroovyElementTypes;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.stubs.elements.*;
|
||||
|
||||
public interface GroovyStubElementTypes {
|
||||
GrClassDefinitionElementType CLASS_TYPE_DEFINITION = GroovyElementTypes.CLASS_TYPE_DEFINITION;
|
||||
GrInterfaceDefinitionElementType INTERFACE_TYPE_DEFINITION = GroovyElementTypes.INTERFACE_TYPE_DEFINITION;
|
||||
GrEnumDefinitionElementType ENUM_TYPE_DEFINITION = GroovyElementTypes.ENUM_TYPE_DEFINITION;
|
||||
GrAnnotationDefinitionElementType ANNOTATION_TYPE_DEFINITION = GroovyElementTypes.ANNOTATION_TYPE_DEFINITION;
|
||||
GrAnonymousElementType ANONYMOUS_TYPE_DEFINITION = GroovyElementTypes.ANONYMOUS_TYPE_DEFINITION;
|
||||
GrTraitElementType TRAIT_TYPE_DEFINITION = GroovyElementTypes.TRAIT_TYPE_DEFINITION;
|
||||
GrEnumConstantInitializerElementType ENUM_CONSTANT_INITIALIZER = GroovyElementTypes.ENUM_CONSTANT_INITIALIZER;
|
||||
|
||||
GrEnumConstantElementType ENUM_CONSTANT = GroovyElementTypes.ENUM_CONSTANT;
|
||||
GrFieldElementType FIELD = GroovyElementTypes.FIELD;
|
||||
GrMethodElementType METHOD = GroovyElementTypes.METHOD;
|
||||
GrAnnotationMethodElementType ANNOTATION_METHOD = GroovyElementTypes.ANNOTATION_METHOD;
|
||||
|
||||
GrImplementsClauseElementType IMPLEMENTS_CLAUSE = GroovyElementTypes.IMPLEMENTS_CLAUSE;
|
||||
GrExtendsClauseElementType EXTENDS_CLAUSE = GroovyElementTypes.EXTENDS_CLAUSE;
|
||||
|
||||
GrPackageDefinitionElementType PACKAGE_DEFINITION = GroovyElementTypes.PACKAGE_DEFINITION;
|
||||
|
||||
GrImportStatementElementType IMPORT = GroovyElementTypes.IMPORT;
|
||||
|
||||
GrTypeParameterElementType TYPE_PARAMETER = GroovyElementTypes.TYPE_PARAMETER;
|
||||
|
||||
GrTypeParameterBoundsElementType TYPE_PARAMETER_BOUNDS_LIST = GroovyElementTypes.TYPE_PARAMETER_BOUNDS_LIST;
|
||||
|
||||
GrMethodElementType CONSTRUCTOR = GroovyElementTypes.CONSTRUCTOR;
|
||||
|
||||
GrThrowsClauseElementType THROWS_CLAUSE = GroovyElementTypes.THROWS_CLAUSE;
|
||||
|
||||
GrNameValuePairElementType ANNOTATION_MEMBER_VALUE_PAIR = GroovyElementTypes.ANNOTATION_MEMBER_VALUE_PAIR;
|
||||
|
||||
GrAnnotationElementType ANNOTATION = GroovyElementTypes.ANNOTATION;
|
||||
|
||||
GrParameterElementType PARAMETER = GroovyElementTypes.PARAMETER;
|
||||
|
||||
GrVariableDeclarationElementType VARIABLE_DECLARATION = GroovyElementTypes.VARIABLE_DECLARATION;
|
||||
GrVariableElementType VARIABLE = GroovyElementTypes.VARIABLE;
|
||||
|
||||
GrModifierListElementType MODIFIER_LIST = GroovyElementTypes.MODIFIER_LIST;
|
||||
}
|
||||
+2
-2
@@ -2,14 +2,14 @@
|
||||
package org.jetbrains.plugins.groovy.lang.parser.parsing.toplevel;
|
||||
|
||||
import com.intellij.lang.PsiBuilder;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
|
||||
import org.jetbrains.plugins.groovy.lang.parser.GroovyParserDefinition;
|
||||
|
||||
@Deprecated
|
||||
public class CompilationUnit {
|
||||
|
||||
@Deprecated
|
||||
public static void parseFile(PsiBuilder builder, GroovyParser parser) {
|
||||
parser.parseLight(GroovyElementTypes.GROOVY_FILE, builder);
|
||||
parser.parseLight(GroovyParserDefinition.GROOVY_FILE, builder);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -101,10 +101,10 @@ public abstract class GroovyFileBaseImpl extends PsiFileBase implements GroovyFi
|
||||
public GrMethod[] getMethods() {
|
||||
final StubElement<?> stub = getGreenStub();
|
||||
if (stub != null) {
|
||||
return stub.getChildrenByType(GroovyElementTypes.METHOD_DEFINITION, GrMethod.ARRAY_FACTORY);
|
||||
return stub.getChildrenByType(GroovyElementTypes.METHOD, GrMethod.ARRAY_FACTORY);
|
||||
}
|
||||
|
||||
return calcTreeElement().getChildrenAsPsiElements(GroovyElementTypes.METHOD_DEFINITION, GrMethod.ARRAY_FACTORY);
|
||||
return calcTreeElement().getChildrenAsPsiElements(GroovyElementTypes.METHOD, GrMethod.ARRAY_FACTORY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -141,10 +141,10 @@ public class GroovyFileImpl extends GroovyFileBaseImpl implements GroovyFile, Ps
|
||||
public GrImportStatement[] getImportStatements() {
|
||||
final StubElement<?> stub = getStub();
|
||||
if (stub != null) {
|
||||
return stub.getChildrenByType(GroovyElementTypes.IMPORT_STATEMENT, GrImportStatement.ARRAY_FACTORY);
|
||||
return stub.getChildrenByType(GroovyElementTypes.IMPORT, GrImportStatement.ARRAY_FACTORY);
|
||||
}
|
||||
|
||||
return calcTreeElement().getChildrenAsPsiElements(GroovyElementTypes.IMPORT_STATEMENT, GrImportStatement.ARRAY_FACTORY);
|
||||
return calcTreeElement().getChildrenAsPsiElements(GroovyElementTypes.IMPORT, GrImportStatement.ARRAY_FACTORY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ import java.util.List;
|
||||
*/
|
||||
public class GrThrowsClauseImpl extends GrReferenceListImpl implements GrThrowsClause {
|
||||
public GrThrowsClauseImpl(GrReferenceListStub stub) {
|
||||
super(stub, GroovyElementTypes.THROW_CLAUSE);
|
||||
super(stub, GroovyElementTypes.THROWS_CLAUSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ public class GrAnnotationArgumentListImpl extends GrStubElementBase<EmptyStub>
|
||||
private static final Logger LOG = Logger.getInstance(GrAnnotationArgumentListImpl.class);
|
||||
|
||||
public GrAnnotationArgumentListImpl(@NotNull EmptyStub stub) {
|
||||
super(stub, GroovyElementTypes.ANNOTATION_ARGUMENTS);
|
||||
super(stub, GroovyElementTypes.ANNOTATION_ARGUMENT_LIST);
|
||||
}
|
||||
|
||||
public GrAnnotationArgumentListImpl(@NotNull ASTNode node) {
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ public class GrAnnotationImpl extends GrStubElementBase<GrAnnotationStub> implem
|
||||
@Override
|
||||
@NotNull
|
||||
public GrAnnotationArgumentList getParameterList() {
|
||||
return getRequiredStubOrPsiChild(GroovyElementTypes.ANNOTATION_ARGUMENTS);
|
||||
return getRequiredStubOrPsiChild(GroovyElementTypes.ANNOTATION_ARGUMENT_LIST);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ public class GrModifierListImpl extends GrStubElementBase<GrModifierListStub>
|
||||
}
|
||||
|
||||
public GrModifierListImpl(GrModifierListStub stub) {
|
||||
this(stub, GroovyElementTypes.MODIFIERS);
|
||||
this(stub, GroovyElementTypes.MODIFIER_LIST);
|
||||
}
|
||||
|
||||
public GrModifierListImpl(GrModifierListStub stub, IStubElementType nodeType) {
|
||||
|
||||
+2
-2
@@ -36,11 +36,11 @@ internal fun getScriptDeclarations(fileImpl: GroovyFileImpl, topLevelOnly: Boole
|
||||
val tree = fileImpl.stubTree ?: return fileImpl.collectScriptDeclarations(topLevelOnly)
|
||||
return if (topLevelOnly) {
|
||||
val root: StubElement<*> = tree.root
|
||||
root.getChildrenByType(GroovyElementTypes.VARIABLE_DEFINITION, GrVariableDeclaration.EMPTY_ARRAY)
|
||||
root.getChildrenByType(GroovyElementTypes.VARIABLE_DECLARATION, GrVariableDeclaration.EMPTY_ARRAY)
|
||||
}
|
||||
else {
|
||||
tree.plainList.filter {
|
||||
it.stubType === GroovyElementTypes.VARIABLE_DEFINITION
|
||||
it.stubType === GroovyElementTypes.VARIABLE_DECLARATION
|
||||
}.map {
|
||||
it.psi as GrVariableDeclaration
|
||||
}.toTypedArray()
|
||||
|
||||
+2
-2
@@ -52,7 +52,7 @@ public class GrVariableDeclarationImpl extends GrStubElementBase<GrVariableDecla
|
||||
}
|
||||
|
||||
public GrVariableDeclarationImpl(@NotNull GrVariableDeclarationStub stub) {
|
||||
super(stub, GroovyElementTypes.VARIABLE_DEFINITION);
|
||||
super(stub, GroovyElementTypes.VARIABLE_DECLARATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,7 +68,7 @@ public class GrVariableDeclarationImpl extends GrStubElementBase<GrVariableDecla
|
||||
@Override
|
||||
@NotNull
|
||||
public GrModifierList getModifierList() {
|
||||
return getRequiredStubOrPsiChild(GroovyElementTypes.MODIFIERS);
|
||||
return getRequiredStubOrPsiChild(GroovyElementTypes.MODIFIER_LIST);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -188,7 +188,7 @@ public class GrParameterImpl extends GrVariableBaseImpl<GrParameterStub> impleme
|
||||
@Override
|
||||
@NotNull
|
||||
public GrModifierList getModifierList() {
|
||||
return getRequiredStubOrPsiChild(GroovyElementTypes.MODIFIERS);
|
||||
return getRequiredStubOrPsiChild(GroovyElementTypes.MODIFIER_LIST);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class GrParameterListImpl extends GrStubElementBase<EmptyStub>
|
||||
}
|
||||
|
||||
public GrParameterListImpl(EmptyStub stub) {
|
||||
super(stub, GroovyElementTypes.PARAMETERS_LIST);
|
||||
super(stub, GroovyElementTypes.PARAMETER_LIST);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ public class GrAnnotationTypeDefinitionImpl extends GrTypeDefinitionImpl impleme
|
||||
}
|
||||
|
||||
public GrAnnotationTypeDefinitionImpl(GrTypeDefinitionStub stub) {
|
||||
super(stub, GroovyElementTypes.ANNOTATION_DEFINITION);
|
||||
super(stub, GroovyElementTypes.ANNOTATION_TYPE_DEFINITION);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ public class GrAnonymousClassDefinitionImpl extends GrTypeDefinitionImpl impleme
|
||||
}
|
||||
|
||||
public GrAnonymousClassDefinitionImpl(GrTypeDefinitionStub stub) {
|
||||
this(stub, GroovyElementTypes.ANONYMOUS_CLASS_DEFINITION);
|
||||
this(stub, GroovyElementTypes.ANONYMOUS_TYPE_DEFINITION);
|
||||
}
|
||||
|
||||
public GrAnonymousClassDefinitionImpl(GrTypeDefinitionStub stub, final GrStubElementType nodeType) {
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ public class GrClassDefinitionImpl extends GrTypeDefinitionImpl implements GrCla
|
||||
}
|
||||
|
||||
public GrClassDefinitionImpl(final GrTypeDefinitionStub stub) {
|
||||
super(stub, GroovyElementTypes.CLASS_DEFINITION);
|
||||
super(stub, GroovyElementTypes.CLASS_TYPE_DEFINITION);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public class GrEnumTypeDefinitionImpl extends GrTypeDefinitionImpl implements Gr
|
||||
}
|
||||
|
||||
public GrEnumTypeDefinitionImpl(GrTypeDefinitionStub stub) {
|
||||
super(stub, GroovyElementTypes.ENUM_DEFINITION);
|
||||
super(stub, GroovyElementTypes.ENUM_TYPE_DEFINITION);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import org.jetbrains.plugins.groovy.lang.psi.stubs.GrTypeDefinitionStub;
|
||||
public class GrInterfaceDefinitionImpl extends GrTypeDefinitionImpl implements GrInterfaceDefinition {
|
||||
|
||||
public GrInterfaceDefinitionImpl(GrTypeDefinitionStub stub) {
|
||||
super(stub, GroovyElementTypes.INTERFACE_DEFINITION);
|
||||
super(stub, GroovyElementTypes.INTERFACE_TYPE_DEFINITION);
|
||||
}
|
||||
|
||||
public GrInterfaceDefinitionImpl(@NotNull ASTNode node) {
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
public class GrTraitTypeDefinitionImpl extends GrTypeDefinitionImpl implements GrTraitTypeDefinition {
|
||||
|
||||
public GrTraitTypeDefinitionImpl(GrTypeDefinitionStub stub) {
|
||||
super(stub, GroovyElementTypes.TRAIT_DEFINITION);
|
||||
super(stub, GroovyElementTypes.TRAIT_TYPE_DEFINITION);
|
||||
}
|
||||
|
||||
public GrTraitTypeDefinitionImpl(@NotNull ASTNode node) {
|
||||
|
||||
+2
-2
@@ -52,7 +52,7 @@ public abstract class GrTypeDefinitionBodyBase extends GrStubElementBase<EmptySt
|
||||
@NotNull
|
||||
@Override
|
||||
public GrField[] getFields() {
|
||||
GrVariableDeclaration[] declarations = getStubOrPsiChildren(GroovyElementTypes.VARIABLE_DEFINITION, GrVariableDeclaration.ARRAY_FACTORY);
|
||||
GrVariableDeclaration[] declarations = getStubOrPsiChildren(GroovyElementTypes.VARIABLE_DECLARATION, GrVariableDeclaration.ARRAY_FACTORY);
|
||||
List<GrField> result = ContainerUtil.newArrayList();
|
||||
for (GrVariableDeclaration declaration : declarations) {
|
||||
GrVariable[] variables = declaration.getVariables();
|
||||
@@ -204,7 +204,7 @@ public abstract class GrTypeDefinitionBodyBase extends GrStubElementBase<EmptySt
|
||||
ASTNode next;
|
||||
for (ASTNode child = first; child != afterLast; child = next) {
|
||||
next = child.getTreeNext();
|
||||
if (child.getElementType() == GroovyElementTypes.CONSTRUCTOR_DEFINITION) {
|
||||
if (child.getElementType() == GroovyElementTypes.CONSTRUCTOR) {
|
||||
ASTNode oldIdentifier = child.findChildByType(GroovyTokenTypes.mIDENT);
|
||||
ASTNode newIdentifier = ((GrTypeDefinition)getParent()).getNameIdentifierGroovy().getNode().copyElement();
|
||||
child.replaceChild(oldIdentifier, newIdentifier);
|
||||
|
||||
+1
-1
@@ -500,7 +500,7 @@ public abstract class GrTypeDefinitionImpl extends GrStubElementBase<GrTypeDefin
|
||||
@Nullable
|
||||
@Override
|
||||
public GrModifierList getModifierList() {
|
||||
return getStubOrPsiChild(GroovyElementTypes.MODIFIERS);
|
||||
return getStubOrPsiChild(GroovyElementTypes.MODIFIER_LIST);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public class GrConstructorImpl extends GrMethodBaseImpl implements GrMethod {
|
||||
}
|
||||
|
||||
public GrConstructorImpl(GrMethodStub stub) {
|
||||
super(stub, GroovyElementTypes.CONSTRUCTOR_DEFINITION);
|
||||
super(stub, GroovyElementTypes.CONSTRUCTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-3
@@ -309,7 +309,7 @@ public abstract class GrMethodBaseImpl extends GrStubElementBase<GrMethodStub> i
|
||||
@Override
|
||||
@NotNull
|
||||
public GrParameterList getParameterList() {
|
||||
final GrParameterList parameterList = getStubOrPsiChild(GroovyElementTypes.PARAMETERS_LIST);
|
||||
final GrParameterList parameterList = getStubOrPsiChild(GroovyElementTypes.PARAMETER_LIST);
|
||||
LOG.assertTrue(parameterList != null);
|
||||
return parameterList;
|
||||
}
|
||||
@@ -317,7 +317,7 @@ public abstract class GrMethodBaseImpl extends GrStubElementBase<GrMethodStub> i
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiReferenceList getThrowsList() {
|
||||
return ObjectUtils.assertNotNull(getStubOrPsiChild(GroovyElementTypes.THROW_CLAUSE));
|
||||
return ObjectUtils.assertNotNull(getStubOrPsiChild(GroovyElementTypes.THROWS_CLAUSE));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -397,7 +397,7 @@ public abstract class GrMethodBaseImpl extends GrStubElementBase<GrMethodStub> i
|
||||
@Override
|
||||
@NotNull
|
||||
public GrModifierList getModifierList() {
|
||||
return ObjectUtils.assertNotNull(getStubOrPsiChild(GroovyElementTypes.MODIFIERS));
|
||||
return ObjectUtils.assertNotNull(getStubOrPsiChild(GroovyElementTypes.MODIFIER_LIST));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ public class GrMethodImpl extends GrMethodBaseImpl implements GrMethod {
|
||||
}
|
||||
|
||||
public GrMethodImpl(GrMethodStub stub) {
|
||||
super(stub, GroovyElementTypes.METHOD_DEFINITION);
|
||||
super(stub, GroovyElementTypes.METHOD);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -150,7 +150,7 @@ public class GrImportStatementImpl extends GrStubElementBase<GrImportStatementSt
|
||||
public GrModifierList getAnnotationList() {
|
||||
GrImportStatementStub stub = getStub();
|
||||
if (stub != null) {
|
||||
return ObjectUtils.assertNotNull(getStubOrPsiChild(GroovyElementTypes.MODIFIERS));
|
||||
return ObjectUtils.assertNotNull(getStubOrPsiChild(GroovyElementTypes.MODIFIER_LIST));
|
||||
}
|
||||
return findNotNullChildByClass(GrModifierList.class);
|
||||
}
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ public class GrPackageDefinitionImpl extends GrStubElementBase<GrPackageDefiniti
|
||||
@Override
|
||||
@NotNull
|
||||
public GrModifierList getAnnotationList() {
|
||||
return getStubOrPsiChild(GroovyElementTypes.MODIFIERS);
|
||||
return getStubOrPsiChild(GroovyElementTypes.MODIFIER_LIST);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ public class GrTypeParameterImpl extends GrStubElementBase<GrTypeParameterStub>
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiReferenceList getExtendsList() {
|
||||
return getRequiredStubOrPsiChild(GroovyElementTypes.TYPE_PARAMETER_EXTENDS_BOUND_LIST);
|
||||
return getRequiredStubOrPsiChild(GroovyElementTypes.TYPE_PARAMETER_BOUNDS_LIST);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -112,7 +112,7 @@ public class GrStubUtils {
|
||||
|
||||
public static boolean isGroovyStaticMemberStub(StubElement<?> stub) {
|
||||
StubElement<?> modifierOwner = stub instanceof GrMethodStub ? stub : stub.getParentStub();
|
||||
GrModifierListStub type = modifierOwner.findChildStubByType(GroovyElementTypes.MODIFIERS);
|
||||
GrModifierListStub type = modifierOwner.findChildStubByType(GroovyElementTypes.MODIFIER_LIST);
|
||||
if (type == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ public class GrVariableDeclarationStub extends StubBase<GrVariableDeclaration> {
|
||||
private volatile SoftReference<GrTypeElement> myTypeElement;
|
||||
|
||||
public GrVariableDeclarationStub(StubElement parent, @Nullable String typeString) {
|
||||
super(parent, GroovyElementTypes.VARIABLE_DEFINITION);
|
||||
super(parent, GroovyElementTypes.VARIABLE_DECLARATION);
|
||||
myTypeString = typeString;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ public class GrModifierListElementType extends GrStubElementType<GrModifierListS
|
||||
@NotNull
|
||||
@Override
|
||||
public GrModifierListStub createStub(@NotNull GrModifierList psi, StubElement parentStub) {
|
||||
return new GrModifierListStub(parentStub, GroovyElementTypes.MODIFIERS, psi.getModifierFlags());
|
||||
return new GrModifierListStub(parentStub, GroovyElementTypes.MODIFIER_LIST, psi.getModifierFlags());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -53,7 +53,7 @@ public class GrModifierListElementType extends GrStubElementType<GrModifierListS
|
||||
@Override
|
||||
@NotNull
|
||||
public GrModifierListStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
|
||||
return new GrModifierListStub(parentStub, GroovyElementTypes.MODIFIERS, dataStream.readVarInt());
|
||||
return new GrModifierListStub(parentStub, GroovyElementTypes.MODIFIER_LIST, dataStream.readVarInt());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-4
@@ -50,17 +50,17 @@ public class GrStubFileElementType extends IStubFileElementType<GrFileStub> {
|
||||
public boolean skipChildProcessingWhenBuildingStubs(@NotNull ASTNode parent, @NotNull ASTNode node) {
|
||||
IElementType childType = node.getElementType();
|
||||
IElementType parentType = parent.getElementType();
|
||||
if (childType == GroovyElementTypes.PARAMETER && parentType != GroovyElementTypes.PARAMETERS_LIST) {
|
||||
if (childType == GroovyElementTypes.PARAMETER && parentType != GroovyElementTypes.PARAMETER_LIST) {
|
||||
return true;
|
||||
}
|
||||
if (childType == GroovyElementTypes.PARAMETERS_LIST && !(parent.getPsi() instanceof GrMethod)) {
|
||||
if (childType == GroovyElementTypes.PARAMETER_LIST && !(parent.getPsi() instanceof GrMethod)) {
|
||||
return true;
|
||||
}
|
||||
if (childType == GroovyElementTypes.MODIFIERS) {
|
||||
if (childType == GroovyElementTypes.MODIFIER_LIST) {
|
||||
if (parentType == GroovyElementTypes.CLASS_INITIALIZER) {
|
||||
return true;
|
||||
}
|
||||
if (parentType == GroovyElementTypes.VARIABLE_DEFINITION && !GroovyElementTypes.VARIABLE_DEFINITION.shouldCreateStub(parent)) {
|
||||
if (parentType == GroovyElementTypes.VARIABLE_DECLARATION && !GroovyElementTypes.VARIABLE_DECLARATION.shouldCreateStub(parent)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -58,7 +58,7 @@ public final class GrVariableElementType extends GrStubElementType<GrVariableStu
|
||||
public boolean shouldCreateStub(ASTNode node) {
|
||||
ASTNode parent = node.getTreeParent();
|
||||
return parent != null &&
|
||||
parent.getElementType() == GroovyElementTypes.VARIABLE_DEFINITION &&
|
||||
GroovyElementTypes.VARIABLE_DEFINITION.shouldCreateStub(parent);
|
||||
parent.getElementType() == GroovyElementTypes.VARIABLE_DECLARATION &&
|
||||
GroovyElementTypes.VARIABLE_DECLARATION.shouldCreateStub(parent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -606,7 +606,8 @@
|
||||
|
||||
<vetoSPICondition implementation="org.jetbrains.plugins.groovy.dgm.GroovyExtensionVetoSPI"/>
|
||||
|
||||
<stubElementTypeHolder class="org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes"/>
|
||||
<stubElementTypeHolder class="org.jetbrains.plugins.groovy.lang.parser.GroovyStubElementTypes" externalIdPrefix="gr."/>
|
||||
<stubElementTypeHolder class="org.jetbrains.plugins.groovy.lang.parser.GroovyEmptyStubElementTypes" externalIdPrefix="Groovy"/>
|
||||
<!--Stubs index-->
|
||||
<stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrFullClassNameIndex"/>
|
||||
<stubIndex implementation="org.jetbrains.plugins.groovy.lang.psi.stubs.index.GrFullScriptNameIndex"/>
|
||||
|
||||
+4
-4
@@ -79,7 +79,7 @@ public class GroovyIndentProcessor extends GroovyElementVisitor {
|
||||
public Indent getChildIndent(@NotNull final GroovyBlock parentBlock, @NotNull final ASTNode child) {
|
||||
myChildType = child.getElementType();
|
||||
if (parentBlock instanceof ClosureBodyBlock) {
|
||||
if (myChildType == GroovyElementTypes.PARAMETERS_LIST) {
|
||||
if (myChildType == GroovyElementTypes.PARAMETER_LIST) {
|
||||
return getNoneIndent();
|
||||
}
|
||||
else if (myChildType != GroovyTokenTypes.mLCURLY && myChildType != GroovyTokenTypes.mRCURLY) {
|
||||
@@ -157,7 +157,7 @@ public class GroovyIndentProcessor extends GroovyElementVisitor {
|
||||
|
||||
@Override
|
||||
public void visitAnnotation(@NotNull GrAnnotation annotation) {
|
||||
if (myChildType == GroovyElementTypes.ANNOTATION_ARGUMENTS) {
|
||||
if (myChildType == GroovyElementTypes.ANNOTATION_ARGUMENT_LIST) {
|
||||
myResult = getContinuationIndent();
|
||||
}
|
||||
else {
|
||||
@@ -280,10 +280,10 @@ public class GroovyIndentProcessor extends GroovyElementVisitor {
|
||||
|
||||
@Override
|
||||
public void visitMethod(@NotNull GrMethod method) {
|
||||
if (myChildType == GroovyElementTypes.PARAMETERS_LIST) {
|
||||
if (myChildType == GroovyElementTypes.PARAMETER_LIST) {
|
||||
myResult = getContinuationIndent();
|
||||
}
|
||||
else if (myChildType == GroovyElementTypes.THROW_CLAUSE) {
|
||||
else if (myChildType == GroovyElementTypes.THROWS_CLAUSE) {
|
||||
myResult = getGroovySettings().ALIGN_THROWS_KEYWORD ? getNoneIndent() : getContinuationIndent();
|
||||
} else if (myChildType == GroovyElementTypes.OPEN_BLOCK) {
|
||||
myResult = getBlockIndent(getGroovySettings().METHOD_BRACE_STYLE);
|
||||
|
||||
+15
-15
@@ -139,7 +139,7 @@ public class GroovySpacingProcessor extends GroovyElementVisitor {
|
||||
|
||||
private boolean manageComments() {
|
||||
if (mySettings.KEEP_FIRST_COLUMN_COMMENT && TokenSets.COMMENT_SET.contains(myType2)) {
|
||||
if (!isAfterElementOrSemi(GroovyElementTypes.IMPORT_STATEMENT)) {
|
||||
if (!isAfterElementOrSemi(GroovyElementTypes.IMPORT)) {
|
||||
myResult = Spacing.createKeepingFirstColumnSpacing(0, Integer.MAX_VALUE, mySettings.KEEP_LINE_BREAKS, keepBlankLines());
|
||||
return true;
|
||||
}
|
||||
@@ -181,7 +181,7 @@ public class GroovySpacingProcessor extends GroovyElementVisitor {
|
||||
|
||||
@Override
|
||||
public void visitAnnotation(@NotNull GrAnnotation annotation) {
|
||||
if (myType2 == GroovyElementTypes.ANNOTATION_ARGUMENTS) {
|
||||
if (myType2 == GroovyElementTypes.ANNOTATION_ARGUMENT_LIST) {
|
||||
createSpaceInCode(mySettings.SPACE_BEFORE_ANOTATION_PARAMETER_LIST);
|
||||
}
|
||||
}
|
||||
@@ -311,7 +311,7 @@ public class GroovySpacingProcessor extends GroovyElementVisitor {
|
||||
|
||||
@Override
|
||||
public void visitEnumConstant(@NotNull GrEnumConstant enumConstant) {
|
||||
if (myType1 == GroovyElementTypes.MODIFIERS) {
|
||||
if (myType1 == GroovyElementTypes.MODIFIER_LIST) {
|
||||
createSpaceInCode(true);
|
||||
} else {
|
||||
manageSpaceBeforeCallLParenth();
|
||||
@@ -352,14 +352,14 @@ public class GroovySpacingProcessor extends GroovyElementVisitor {
|
||||
myResult = Spacing.createSpacing(0, 0, mySettings.BLANK_LINES_AROUND_CLASS + 1, mySettings.KEEP_LINE_BREAKS, keepBlankLines());
|
||||
}
|
||||
}
|
||||
else if (isAfterElementOrSemi(GroovyElementTypes.IMPORT_STATEMENT) && myType2 != GroovyElementTypes.IMPORT_STATEMENT) { //after imports
|
||||
else if (isAfterElementOrSemi(GroovyElementTypes.IMPORT) && myType2 != GroovyElementTypes.IMPORT) { //after imports
|
||||
myResult = Spacing.createSpacing(0, 0, mySettings.BLANK_LINES_AFTER_IMPORTS + 1, mySettings.KEEP_LINE_BREAKS, keepBlankLines());
|
||||
}
|
||||
else if (myType1 != GroovyElementTypes.IMPORT_STATEMENT && !isSemiAfter(GroovyElementTypes.IMPORT_STATEMENT) && myType2 ==
|
||||
GroovyElementTypes.IMPORT_STATEMENT) { //before imports
|
||||
else if (myType1 != GroovyElementTypes.IMPORT && !isSemiAfter(GroovyElementTypes.IMPORT) && myType2 ==
|
||||
GroovyElementTypes.IMPORT) { //before imports
|
||||
myResult = Spacing.createSpacing(0, 0, mySettings.BLANK_LINES_BEFORE_IMPORTS, mySettings.KEEP_LINE_BREAKS, keepBlankLines());
|
||||
}
|
||||
else if (isAfterElementOrSemi(GroovyElementTypes.IMPORT_STATEMENT) && myType2 == GroovyElementTypes.IMPORT_STATEMENT) {
|
||||
else if (isAfterElementOrSemi(GroovyElementTypes.IMPORT) && myType2 == GroovyElementTypes.IMPORT) {
|
||||
myResult = Spacing.createSpacing(0, 0, 1, mySettings.KEEP_LINE_BREAKS, keepBlankLines());
|
||||
}
|
||||
else {
|
||||
@@ -418,8 +418,8 @@ public class GroovySpacingProcessor extends GroovyElementVisitor {
|
||||
else if (myType1 == GroovyTokenTypes.mLCURLY && myType2 == GroovyTokenTypes.mRCURLY) { //empty closure
|
||||
createSpaceInCode(false);
|
||||
}
|
||||
else if (myType1 == GroovyTokenTypes.mLCURLY && myType2 != GroovyElementTypes.PARAMETERS_LIST && myType2 !=
|
||||
GroovyTokenTypes.mCLOSABLE_BLOCK_OP || myType2 ==
|
||||
else if (myType1 == GroovyTokenTypes.mLCURLY && myType2 != GroovyElementTypes.PARAMETER_LIST && myType2 !=
|
||||
GroovyTokenTypes.mCLOSABLE_BLOCK_OP || myType2 ==
|
||||
GroovyTokenTypes.mRCURLY) { //spaces between statements
|
||||
boolean spacesWithinBraces = closure.getParent() instanceof GrStringInjection
|
||||
? myGroovySettings.SPACE_WITHIN_GSTRING_INJECTION_BRACES
|
||||
@@ -429,8 +429,8 @@ public class GroovySpacingProcessor extends GroovyElementVisitor {
|
||||
else if (myType1 == GroovyTokenTypes.mCLOSABLE_BLOCK_OP) {
|
||||
myResult = GroovySpacingProcessorBasic.createDependentSpacingForClosure(mySettings, myGroovySettings, closure, true);
|
||||
}
|
||||
else if (myType1 == GroovyTokenTypes.mLCURLY && (myType2 == GroovyElementTypes.PARAMETERS_LIST || myType2 ==
|
||||
GroovyTokenTypes.mCLOSABLE_BLOCK_OP)) {
|
||||
else if (myType1 == GroovyTokenTypes.mLCURLY && (myType2 == GroovyElementTypes.PARAMETER_LIST || myType2 ==
|
||||
GroovyTokenTypes.mCLOSABLE_BLOCK_OP)) {
|
||||
boolean spacesWithinBraces = closure.getParent() instanceof GrStringInjection
|
||||
? myGroovySettings.SPACE_WITHIN_GSTRING_INJECTION_BRACES
|
||||
: mySettings.SPACE_WITHIN_BRACES;
|
||||
@@ -514,7 +514,7 @@ public class GroovySpacingProcessor extends GroovyElementVisitor {
|
||||
if (myType2 == GroovyTokenTypes.mSEMI) return;
|
||||
|
||||
if (typeDefinitionBody != null) { //check variable definitions only inside class body
|
||||
if ((myType1 == GroovyElementTypes.VARIABLE_DEFINITION || isSemiAfter(GroovyElementTypes.VARIABLE_DEFINITION)) && TokenSets.METHOD_DEFS.contains(myType2)) {
|
||||
if ((myType1 == GroovyElementTypes.VARIABLE_DECLARATION || isSemiAfter(GroovyElementTypes.VARIABLE_DECLARATION)) && TokenSets.METHOD_DEFS.contains(myType2)) {
|
||||
final int minBlankLines = Math.max(
|
||||
isInterface ? mySettings.BLANK_LINES_AROUND_METHOD_IN_INTERFACE : mySettings.BLANK_LINES_AROUND_METHOD,
|
||||
isInterface ? mySettings.BLANK_LINES_AROUND_FIELD_IN_INTERFACE : mySettings.BLANK_LINES_AROUND_FIELD
|
||||
@@ -522,8 +522,8 @@ public class GroovySpacingProcessor extends GroovyElementVisitor {
|
||||
myResult = Spacing.createSpacing(0, 0, minBlankLines + 1, mySettings.KEEP_LINE_BREAKS, keepBlankLines());
|
||||
return;
|
||||
}
|
||||
else if (myType1 == GroovyElementTypes.VARIABLE_DEFINITION || isSemiAfter(GroovyElementTypes.VARIABLE_DEFINITION) || myType2 ==
|
||||
GroovyElementTypes.VARIABLE_DEFINITION) {
|
||||
else if (myType1 == GroovyElementTypes.VARIABLE_DECLARATION || isSemiAfter(GroovyElementTypes.VARIABLE_DECLARATION) || myType2 ==
|
||||
GroovyElementTypes.VARIABLE_DECLARATION) {
|
||||
final int minBlankLines =
|
||||
isInterface ? mySettings.BLANK_LINES_AROUND_FIELD_IN_INTERFACE : mySettings.BLANK_LINES_AROUND_FIELD;
|
||||
myResult = Spacing.createSpacing(0, 0, minBlankLines + 1, mySettings.KEEP_LINE_BREAKS, keepBlankLines());
|
||||
@@ -594,7 +594,7 @@ public class GroovySpacingProcessor extends GroovyElementVisitor {
|
||||
if (myType2 == PARAMETER_LIST) {
|
||||
createSpaceInCode(mySettings.SPACE_BEFORE_METHOD_PARENTHESES);
|
||||
}
|
||||
else if (myType1 == PARAMETER_LIST && myType2 == GroovyElementTypes.THROW_CLAUSE) {
|
||||
else if (myType1 == PARAMETER_LIST && myType2 == GroovyElementTypes.THROWS_CLAUSE) {
|
||||
if (mySettings.THROWS_KEYWORD_WRAP == CommonCodeStyleSettings.WRAP_ALWAYS) {
|
||||
createLF(true);
|
||||
}
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@ public abstract class GroovySpacingProcessorBasic {
|
||||
}
|
||||
|
||||
//todo:check it for multiple assignments
|
||||
if ((GroovyElementTypes.VARIABLE_DEFINITION.equals(leftType) || GroovyElementTypes.VARIABLE_DEFINITION.equals(rightType)) &&
|
||||
if ((GroovyElementTypes.VARIABLE_DECLARATION.equals(leftType) || GroovyElementTypes.VARIABLE_DECLARATION.equals(rightType)) &&
|
||||
!(leftNode.getTreeNext() instanceof PsiErrorElement)) {
|
||||
return getStatementSpacing(context);
|
||||
}
|
||||
|
||||
+13
-13
@@ -117,11 +117,11 @@ public class GroovyWrappingProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
if (myParentType == GroovyElementTypes.THROW_CLAUSE && childType == GroovyTokenTypes.kTHROWS) {
|
||||
if (myParentType == GroovyElementTypes.THROWS_CLAUSE && childType == GroovyTokenTypes.kTHROWS) {
|
||||
return Wrap.createWrap(mySettings.THROWS_KEYWORD_WRAP, true);
|
||||
}
|
||||
|
||||
if (myParentType == GroovyElementTypes.MODIFIERS) {
|
||||
if (myParentType == GroovyElementTypes.MODIFIER_LIST) {
|
||||
if (getLeftSiblingType(childNode) == GroovyElementTypes.ANNOTATION) {
|
||||
return getCommonWrap();
|
||||
}
|
||||
@@ -138,7 +138,7 @@ public class GroovyWrappingProcessor {
|
||||
|
||||
if (ANNOTATION_CONTAINERS.contains(myParentType)) {
|
||||
final ASTNode leftSibling = getLeftSibling(childNode);
|
||||
if (leftSibling != null && leftSibling.getElementType() == GroovyElementTypes.MODIFIERS && endsWithAnnotation(leftSibling)) {
|
||||
if (leftSibling != null && leftSibling.getElementType() == GroovyElementTypes.MODIFIER_LIST && endsWithAnnotation(leftSibling)) {
|
||||
final int wrapType = getAnnotationsWrapType(childNode);
|
||||
if (wrapType != -1) {
|
||||
return Wrap.createWrap(wrapType, true);
|
||||
@@ -200,13 +200,13 @@ public class GroovyWrappingProcessor {
|
||||
}
|
||||
|
||||
|
||||
if (myParentType == GroovyElementTypes.THROW_CLAUSE) {
|
||||
if (myParentType == GroovyElementTypes.THROWS_CLAUSE) {
|
||||
myUsedDefaultWrap = true;
|
||||
return Wrap.createWrap(mySettings.THROWS_LIST_WRAP, true);
|
||||
}
|
||||
|
||||
|
||||
if (myParentType == GroovyElementTypes.PARAMETERS_LIST) {
|
||||
if (myParentType == GroovyElementTypes.PARAMETER_LIST) {
|
||||
myUsedDefaultWrap = true;
|
||||
return Wrap.createWrap(mySettings.METHOD_PARAMETERS_WRAP, false);
|
||||
}
|
||||
@@ -253,7 +253,7 @@ public class GroovyWrappingProcessor {
|
||||
return createNormalWrap();
|
||||
}
|
||||
|
||||
if (myParentType == GroovyElementTypes.MODIFIERS) {
|
||||
if (myParentType == GroovyElementTypes.MODIFIER_LIST) {
|
||||
final int wrapType = getAnnotationsWrapType(myNode);
|
||||
if (wrapType != -1) {
|
||||
myUsedDefaultWrap = true;
|
||||
@@ -270,13 +270,13 @@ public class GroovyWrappingProcessor {
|
||||
}
|
||||
|
||||
private final TokenSet ANNOTATION_CONTAINERS = TokenSet.create(
|
||||
GroovyElementTypes.CLASS_DEFINITION, GroovyElementTypes.INTERFACE_DEFINITION, GroovyElementTypes.ENUM_DEFINITION, GroovyElementTypes.TRAIT_DEFINITION,
|
||||
GroovyElementTypes.ANNOTATION_DEFINITION,
|
||||
GroovyElementTypes.METHOD_DEFINITION, GroovyElementTypes.CONSTRUCTOR_DEFINITION,
|
||||
GroovyElementTypes.VARIABLE_DEFINITION,
|
||||
GroovyElementTypes.CLASS_TYPE_DEFINITION, GroovyElementTypes.INTERFACE_TYPE_DEFINITION, GroovyElementTypes.ENUM_TYPE_DEFINITION, GroovyElementTypes.TRAIT_TYPE_DEFINITION,
|
||||
GroovyElementTypes.ANNOTATION_TYPE_DEFINITION,
|
||||
GroovyElementTypes.METHOD, GroovyElementTypes.CONSTRUCTOR,
|
||||
GroovyElementTypes.VARIABLE_DECLARATION,
|
||||
GroovyElementTypes.PARAMETER,
|
||||
GroovyElementTypes.ENUM_CONSTANT,
|
||||
GroovyElementTypes.IMPORT_STATEMENT
|
||||
GroovyElementTypes.IMPORT
|
||||
);
|
||||
|
||||
private int getAnnotationsWrapType(ASTNode modifierList) {
|
||||
@@ -289,7 +289,7 @@ public class GroovyWrappingProcessor {
|
||||
return mySettings.METHOD_ANNOTATION_WRAP;
|
||||
}
|
||||
|
||||
if (GroovyElementTypes.VARIABLE_DEFINITION == containerType) {
|
||||
if (GroovyElementTypes.VARIABLE_DECLARATION == containerType) {
|
||||
final IElementType pparentType = modifierList.getTreeParent().getTreeParent().getElementType();
|
||||
if (pparentType == GroovyElementTypes.CLASS_BODY || pparentType == GroovyElementTypes.ENUM_BODY) {
|
||||
return mySettings.FIELD_ANNOTATION_WRAP;
|
||||
@@ -307,7 +307,7 @@ public class GroovyWrappingProcessor {
|
||||
return mySettings.ENUM_CONSTANTS_WRAP;
|
||||
}
|
||||
|
||||
if (GroovyElementTypes.IMPORT_STATEMENT == containerType) {
|
||||
if (GroovyElementTypes.IMPORT == containerType) {
|
||||
return myContext.getGroovySettings().IMPORT_ANNOTATION_WRAP;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user