List<TextRange> (@NotNull PsiElement e, @NotNull CharSequence editorText, int cursorOffset, @NotNull Editor editor) { List<TextRange> superResult = super.select(e, editorText, cursorOffset, editor); HighlighterIterator iterator = editor.getHighlighter().createIterator(cursorOffset); if (CustomFileTypeQuoteHandler.isQuotedToken(iterator.getTokenType())) { List<TextRange> result = new ArrayList<>(); int start = iterator.getStart(); int end = iterator.getEnd(); char limitingQuote = CustomFileTypeQuoteHandler.getLimitingQuote(iterator.getTokenType()); int startAfterQuote = start + ((start < editorText.length() && editorText.charAt(start) == limitingQuote) ? 1 : 0); int endBeforeQuote = end - ((end > 0 && editorText.charAt(end - 1) == limitingQuote) ? 1 : 0); if (start < startAfterQuote && end > endBeforeQuote && (end - start) > 1) result.add(new TextRange(start, end)); if (startAfterQuote < endBeforeQuote) result.add(new TextRange(startAfterQuote, endBeforeQuote)); if (superResult != null) { result.addAll(superResult); } return result; } return superResult; }