List<TextRange> (@NotNull PsiElement e, @NotNull CharSequence editorText, int cursorOffset, @NotNull Editor editor) { ASTNode node = BasicJavaAstTreeUtil.toNode(e); if (node == null) { return null; } List<ASTNode> children = BasicJavaAstTreeUtil.getChildren(node); int start = 0; int end = 0; for (ASTNode child : children) { if (BasicJavaAstTreeUtil.isJavaToken(child)) { if (BasicJavaAstTreeUtil.is(child, JavaTokenType.LPARENTH)) { start = BasicJavaAstTreeUtil.getTextOffset(child) + 1; } if (BasicJavaAstTreeUtil.is(child, JavaTokenType.RPARENTH)) { end = BasicJavaAstTreeUtil.getTextOffset(child); } } } List<TextRange> result = new ArrayList<>(); if (start != 0 && end != 0) { result.add(new TextRange(start, end)); } return result; }