List<TextRange> (@NotNull PsiElement element, @NotNull CharSequence editorText, int cursorOffset, @NotNull Editor editor) { List<TextRange> result = super.select(element, editorText, cursorOffset, editor); if (element instanceof GrArgumentList args) { TextRange range = args.getTextRange(); if (range.contains(cursorOffset)) { PsiElement leftParen = args.getLeftParen(); PsiElement rightParen = args.getRightParen(); if (leftParen != null) { int leftOffset = leftParen.getTextOffset(); if (rightParen != null) { if (leftOffset + 1 < rightParen.getTextOffset()) { int rightOffset = rightParen.getTextRange().getEndOffset(); range = new TextRange(leftParen.getTextRange().getStartOffset() + 1, rightOffset - 1); result.add(range); } } else { range = new TextRange(leftParen.getTextRange().getStartOffset() + 1, element.getTextRange().getEndOffset()); result.add(range); } } } } final PsiElement parent = element.getParent(); if (parent instanceof GrReferenceExpression) { final GrArgumentList argumentList = ((GrCall)parent.getParent()).getArgumentList(); final PsiElement refName = ((GrReferenceExpression)parent).getReferenceNameElement(); if (argumentList != null && refName == element) { result.add(new TextRange(refName.getTextRange().getStartOffset(), argumentList.getTextRange().getEndOffset())); } } return result; }