boolean (@NotNull Editor editor, @NotNull ASTNode astNode, boolean isModified) { PsiElement psiElement = BasicJavaAstTreeUtil.toPsi(astNode); if (psiElement == null) { return false; } if (BasicJavaAstTreeUtil.is(astNode, BASIC_EXPRESSION_STATEMENT) || BasicJavaAstTreeUtil.is(astNode, BASIC_DECLARATION_STATEMENT) || BasicJavaAstTreeUtil.is(astNode, BASIC_DO_WHILE_STATEMENT) || BasicJavaAstTreeUtil.is(astNode, BASIC_RETURN_STATEMENT) || BasicJavaAstTreeUtil.is(astNode, BASIC_THROW_STATEMENT) || BasicJavaAstTreeUtil.is(astNode, BASIC_BREAK_STATEMENT) || BasicJavaAstTreeUtil.is(astNode, BASIC_CONTINUE_STATEMENT) || BasicJavaAstTreeUtil.is(astNode, BASIC_YIELD_STATEMENT) || BasicJavaAstTreeUtil.is(astNode, BASIC_ASSERT_STATEMENT) || BasicJavaAstTreeUtil.is(astNode, Set.of(BASIC_FIELD, BASIC_ENUM_CONSTANT)) || isImportStatementBase(psiElement) || isMethodWithoutBody(psiElement)) { int errorOffset = getErrorElementOffset(psiElement); int elementEndOffset = astNode.getTextRange().getEndOffset(); if (BasicJavaAstTreeUtil.is(astNode, BASIC_ENUM_CONSTANT)) { final CharSequence text = editor.getDocument().getCharsSequence(); final int commaOffset = CharArrayUtil.shiftForwardUntil(text, elementEndOffset, ","); if (commaOffset < text.length()) { elementEndOffset = commaOffset + 1; } } if (errorOffset >= 0 && errorOffset < elementEndOffset) { final CharSequence text = editor.getDocument().getCharsSequence(); if (text.charAt(errorOffset) == ' ' && text.charAt(errorOffset + 1) == ';') { errorOffset++; } } editor.getCaretModel().moveToOffset(errorOffset >= 0 ? errorOffset : elementEndOffset); return isModified; } return false; }