Cancel progress programmatically in VS Code extensions

With the Visual Studio Code progress notification (vscode.window.withProgress), you can make it cancellable. This cancellable option allows the user to cancel it by clicking on a cancel button.
Progress notification in Visual Studio Code What if you want to cancel it programmatically? That was the case for one of my extensions.
Published on:
Learn more