Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

## Unable to Retrieve Available Code Actions - Cancellation Error #1

Open
ahmad-shoja opened this issue Feb 27, 2024 · 0 comments
Open
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@ahmad-shoja
Copy link
Owner

ahmad-shoja commented Feb 27, 2024

Description

When attempting to retrieve available code actions using the vscode.executeCodeActionProvider command, the operation is getting canceled, resulting in an error.

Steps to Reproduce

  1. Trigger the code that attempts to retrieve available code actions.
  2. Observe the error in the console or logs.
 const codeActions = await vscode.commands.executeCommand(
    "vscode.executeCodeActionProvider",
    classFileUri,
    range
);

Expected Behavior

The executeCodeActionProvider command should return the available code actions without cancellation errors.

Actual Behavior

The operation is canceled, and an error is encountered.

Workaround

Wrapping the code in a setTimeout of 5 seconds seems to be a workaround that allows the operation to complete successfully:

setTimeout(async () => {
    const codeActions = await vscode.commands.executeCommand(
        "vscode.executeCodeActionProvider",
        classFileUri,
        range
    );
    // Rest of the code using codeActions
}, 5000);

Environment

Visual Studio Code Version: 1.86.2
Operating System: [Windows 10]

@ahmad-shoja ahmad-shoja added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant