@NotNull
  @Override
  public Result beforeCharTyped(char c,
                                @NotNull Project project,
                                @NotNull Editor editor,
                                @NotNull PsiFile file,
                                @NotNull FileType fileType) {
    if (fileType == TextMateFileType.INSTANCE) {
      if (c == '\'' || c == '"' || c == '`') {
        if (!CodeInsightSettings.getInstance().AUTOINSERT_PAIR_QUOTE) {
          return Result.CONTINUE;
        }
      }
      else if (!CodeInsightSettings.getInstance().AUTOINSERT_PAIR_BRACKET) {
        return Result.CONTINUE;
      }

      final int offset = editor.getCaretModel().getOffset();
      @Nullable TextMateScope scopeSelector = TextMateEditorUtils.getCurrentScopeSelector((EditorEx)editor);

      final Document document = editor.getDocument();
      final TextMateAutoClosingPair pairForRightChar = findSingleCharSmartTypingPair(c, scopeSelector);
      if (pairForRightChar != null) {
        if (offset < document.getTextLength() && document.getCharsSequence().charAt(offset) == c) {
          EditorModificationUtil.moveCaretRelatively(editor, 1);
          return Result.STOP;
        }
      }
    }
    return Result.CONTINUE;
  }
@NotNull
  @Override
  public Result beforeCharTyped(char c,
                                @NotNull Project project,
                                @NotNull Editor editor,
                                @NotNull PsiFile file,
                                @NotNull FileType fileType)