@Override
  public void beforeCharDeleted(char c, PsiFile file, Editor editor) {
    if (c != '{') return;

    if (!(file instanceof GroovyFile)) return;

    final int offset = editor.getCaretModel().getOffset();

    final EditorHighlighter highlighter = editor.getHighlighter();
    if (offset < 1) return;

    HighlighterIterator iterator = highlighter.createIterator(offset);
    if (iterator.getTokenType() != GroovyTokenTypes.mRCURLY) return;
    iterator.retreat();
    if (iterator.getStart() < 1 || iterator.getTokenType() != GroovyTokenTypes.mLCURLY) return;

    editor.getDocument().deleteString(offset, offset + 1);
  }
@Override
  public void beforeCharDeleted(char c, PsiFile file, Editor editor)