mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
indent in spock's labels should work in preview
This commit is contained in:
+15
-1
@@ -58,6 +58,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrImplements
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinitionBody;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement;
|
||||
import org.jetbrains.plugins.groovy.spock.SpockUtils;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes.*;
|
||||
@@ -165,7 +166,7 @@ public class GroovyIndentProcessor extends GroovyElementVisitor {
|
||||
|
||||
final GrTypeDefinition clazz = PsiTreeUtil.getParentOfType(place, GrTypeDefinition.class);
|
||||
if (clazz == null) return false;
|
||||
if (InheritanceUtil.isInheritor(clazz, SpockUtils.SPEC_CLASS_NAME)) {
|
||||
if (isDirectInheritorOfSpecification(clazz) || InheritanceUtil.isInheritor(clazz, SpockUtils.SPEC_CLASS_NAME)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -179,6 +180,19 @@ public class GroovyIndentProcessor extends GroovyElementVisitor {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean isDirectInheritorOfSpecification(@NotNull GrTypeDefinition clazz) {
|
||||
final GrExtendsClause clause = clazz.getExtendsClause();
|
||||
if (clause != null) {
|
||||
final GrCodeReferenceElement[] refs = clause.getReferenceElements();
|
||||
for (GrCodeReferenceElement ref : refs) {
|
||||
if (SpockUtils.SPEC_CLASS_NAME.equals(ref.getClassNameText())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitAnnotation(GrAnnotation annotation) {
|
||||
if (myChildType == ANNOTATION_ARGUMENTS) {
|
||||
|
||||
Reference in New Issue
Block a user