List<TextRange> (@NotNull PsiElement e, @NotNull CharSequence editorText, int cursorOffset, @NotNull Editor editor) { List<TextRange> result = new ArrayList<>(expandToWholeLine(editorText, e.getTextRange(), false)); List<ASTNode> children = BasicJavaAstTreeUtil.getChildren(BasicJavaAstTreeUtil.toNode(e)); ASTNode lParen = null; ASTNode rParen = null; for (ASTNode child : children) { if (BasicJavaAstTreeUtil.is(child, JavaTokenType.LPARENTH)) lParen = child; if (BasicJavaAstTreeUtil.is(child, JavaTokenType.RPARENTH)) rParen = child; } if (lParen != null && rParen != null) { result.addAll(expandToWholeLine(editorText, new TextRange(lParen.getTextRange().getStartOffset(), rParen.getTextRange().getEndOffset()), false)); } return result; }