boolean (char c, @NotNull PsiFile file, @NotNull Editor editor) { if (editor.getUserData(SubstitutionShortInfoHandler.CURRENT_CONFIGURATION_KEY) == null || !CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET) { return false; } if (c == '$') { final Document document = editor.getDocument(); final CharSequence text = document.getCharsSequence(); final Caret caret = editor.getCaretModel().getCurrentCaret(); final int offset = caret.getOffset(); final LogicalPosition position = caret.getLogicalPosition(); final int lineStart = document.getLineStartOffset(position.line); final int lineEnd = document.getLineEndOffset(position.line); if (text.length() > offset && text.charAt(offset) == '$' && StructuralSearchTypedHandler.hasOddDollar(text, lineStart, lineEnd)) { document.deleteString(offset, offset + 1); } return true; } return false; }