List<TextRange> (@NotNull PsiElement e, @NotNull CharSequence editorText, int cursorOffset, @NotNull Editor editor) { List<TextRange> result = super.select(e, editorText, cursorOffset, editor); if (result == null) { return null; } ASTNode node = BasicJavaAstTreeUtil.toNode(e); if (node == null) { return null; } TextRange fieldRange = node.getTextRange(); ASTNode nameId = BasicJavaAstTreeUtil.getNameIdentifier(node); if (nameId == null) return new ArrayList<>(); TextRange nameRange = nameId.getTextRange(); ASTNode last = BasicJavaAstTreeUtil.getInitializer(node); int end = last == null ? nameRange.getEndOffset() : last.getTextRange().getEndOffset(); ASTNode comment = BasicJavaAstTreeUtil.getDocComment(node); if (comment != null) { TextRange commentTextRange = comment.getTextRange(); addRangeElem(result, editorText, comment, commentTextRange.getEndOffset()); } addRangeElem(result, editorText, nameId, end); addRangeElem(result, editorText, BasicJavaAstTreeUtil.getTypeElement(node), nameRange.getEndOffset()); addRangeElem(result, editorText, BasicJavaAstTreeUtil.getModifierList(node), fieldRange.getEndOffset()); result.addAll(expandToWholeLine(editorText, fieldRange)); return result; }