List<TextRange> (@NotNull PsiElement e, @NotNull CharSequence editorText, int cursorOffset, @NotNull Editor editor) { List<TextRange> result = super.select(e, editorText, cursorOffset, editor); if (e instanceof GrTypeCastExpression castExpression) { GrTypeElement type = castExpression.getCastTypeElement(); TextRange range = type.getTextRange(); if (range.contains(cursorOffset)) { PsiElement leftParen = castExpression.getLeftParen(); PsiElement rightParen = castExpression.getRightParen(); if (leftParen.getTextOffset() < rightParen.getTextOffset()) { range = new TextRange(leftParen.getTextRange().getStartOffset(), rightParen.getTextRange().getEndOffset()); result.add(range); } } } return result; }