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

Implement CancellationToken logic for withProgress API #11027

Merged
merged 5 commits into from
Apr 21, 2022

Conversation

matt-dot
Copy link
Contributor

@matt-dot matt-dot commented Apr 14, 2022

What it does

How to test

  • Clone this VS Code Example and open in Theia
  • Run the Launch Extension launch configuration
  • Add a console.log within the setTimeout callbacks here to check the value of token.isCancellationRequested
  • Run the extension's showProgress command (using the command pallette) and press the cancel button contained in the notification
  • Pre-changes
    • No console output from within token.onCancellationRequested
    • token.isCancellationRequested remains false indefinitely
  • Post-changes
    • Console output from within token.onCancellationRequested
    • token.isCancellationRequested changes based on button press

Review checklist

Reminder for reviewers

Signed-off-by: Matthew Langley [email protected]

@matt-dot matt-dot changed the title Implement CancellationToken logic Implement CancellationToken logic for withProgress API Apr 14, 2022
Copy link
Contributor

@colin-grant-work colin-grant-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, @matt-dot! I believe this is working well. The extraneous TASKS_MAIN should be removed (I think), and it would be helpful to update the testing instructions:

Add a console.log checking the value of token.isCancellationRequested

Add a console.log where? In my testing it, I added it to the setTimeout callbacks here, but the instructions should provide more detail.

Run and press the cancel button contained in the notification

Run what? I assume the extension's 'Show Progress' command.

packages/plugin-ext/src/common/plugin-api-rpc.ts Outdated Show resolved Hide resolved
@matt-dot
Copy link
Contributor Author

matt-dot commented Apr 14, 2022

Yes your assumptions are correct and I have amended the instructions. I'll be sure to be more detailed and specific in the future 👍

@JonasHelming JonasHelming added the vscode issues related to VSCode compatibility label Apr 19, 2022
Copy link
Contributor

@colin-grant-work colin-grant-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the contribution!

@westbury westbury merged commit e28c82b into eclipse-theia:master Apr 21, 2022
@westbury westbury deleted the cancel-notifications-token branch April 21, 2022 13:40
@colin-grant-work colin-grant-work added this to the 1.25.0 milestone Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cancellation functionality for withProgress API
4 participants