@Override
  public final @NotNull CompletableFuture<?> execute(@NotNull PlaybackContext context) {
    try {
      if (isToDumpCommand()) {
        context.code(getText(), getLine());
      }

      CompletableFuture<Object> result = new CompletableFuture<>();
      Runnable runnable = Context.current().wrap(() -> {
        try {
          Promises.asCompletableFuture(_execute(context)).whenComplete((o, throwable) -> {
            if (throwable == null) {
              result.complete(o);
            }
            else {
              result.completeExceptionally(throwable);
            }
          });
        }
        catch (Throwable e) {
          LOG.error(e);
          dumpError(context, e.getMessage());
          result.completeExceptionally(e);
        }
      });

      Application application = ApplicationManager.getApplication();
      if (executeInAwt) {
        // Prevent previous action context affecting next action.
        // E.g., previous action may have called callback.setDone from inside write action, while
        // the next action may not expect that
        application.invokeLater(runnable);
      }
      else {
        application.executeOnPooledThread(runnable);
      }
      return result;
    }
    catch (Throwable e) {
      dumpError(context, e.getMessage());
      return CompletableFuture.failedFuture(e);
    }
  }
@Override
  public final @NotNull CompletableFuture<?> execute(@NotNull PlaybackContext context)