int (@NotNull PsiElement element, @NotNull CharSequence documentChars) { if (element instanceof GrVariableDeclarationImpl) { GrVariable[] variables = ((GrVariableDeclarationImpl)element).getVariables(); if (variables.length == 1 && variables[0] instanceof GrField && variables[0].getInitializerGroovy() instanceof GrClosableBlock) { return 2; } } if (element instanceof GrField || element instanceof GrTypeParameter) return 1; if (element instanceof GrTypeDefinition || element instanceof GrClassInitializer) return 2; if (element instanceof GrMethod) { if (((GrMethod)element).hasModifierProperty(PsiModifier.ABSTRACT) && !(((GrMethod)element).getBlock() != null && GrTraitUtil.isTrait(((GrMethod)element).getContainingClass()))) { return 1; } TextRange textRange = element.getTextRange(); int start = textRange.getStartOffset(); int end = Math.min(documentChars.length(), textRange.getEndOffset()); int crlf = StringUtil.getLineBreakCount(documentChars.subSequence(start, end)); return crlf == 0 ? 1 : 2; } return 0; }