public void finishLookup(char completionChar, final @Nullable LookupElement item) {
    LOG.assertTrue(!ApplicationManager.getApplication().isWriteAccessAllowed(), "finishLookup should be called without a write action");
    final PsiFile file = getPsiFile();
    boolean writableOk = file == null || FileModificationService.getInstance().prepareFileForWrite(file);
    if (isLookupDisposed()) { // ensureFilesWritable could close us by showing a dialog
      return;
    }

    if (!writableOk) {
      hideWithItemSelected(null, completionChar);
      return;
    }
    CommandProcessor.getInstance().executeCommand(project, () -> {
      try (AccessToken ignore = SlowOperations.knownIssue("IDEA-346621, EA-1083788")) {
        finishLookupInWritableFile(completionChar, item);
      }
    }, null, null);
  }
public void finishLookup(char completionChar, final @Nullable LookupElement item)