@Override
  public void performForCommittedDocument(@NotNull Document doc, @NotNull Runnable action) {
    Document document = getTopLevelDocument(doc);
    if (isCommitted(document)) {
      action.run();
    }
    else {
      addRunOnCommit(document, action);
    }
  }
@Override
  public void performForCommittedDocument(@NotNull Document doc, @NotNull Runnable action)