boolean (final char c) { return c == '(' || c == '{' || c == '[' || c == '<'; } private static boolean isQuote(final char c) { return c == '"' || c == '\'' || c == '`'; } private static boolean isSimilarDelimiters(final char c1, final char c2) { return (isBracket(c1) && isBracket(c2)) || (isQuote(c1) && isQuote(c2)); } private static void replaceChar(Document document, int offset, char newChar) { document.replaceString(offset, offset + 1, String.valueOf(newChar)); } public static abstract class UnquotingFilter { public abstract boolean skipReplacementQuotesOrBraces(@NotNull PsiFile file, @NotNull Editor editor, @NotNull String selectedText, char c); } }