(context: ExtensionContext)
| 5 | import { commands, ExtensionContext, ProgressLocation, window } from 'vscode'; |
| 6 | |
| 7 | export function activate(context: ExtensionContext) { |
| 8 | context.subscriptions.push(commands.registerCommand('extension.startTask', () => { |
| 9 | window.withProgress({ |
| 10 | location: ProgressLocation.Notification, |
| 11 | title: "I am long running!", |
| 12 | cancellable: true |
| 13 | }, (progress, token) => { |
| 14 | token.onCancellationRequested(() => { |
| 15 | console.log("User canceled the long running operation"); |
| 16 | }); |
| 17 | |
| 18 | progress.report({ increment: 0 }); |
| 19 | |
| 20 | setTimeout(() => { |
| 21 | progress.report({ increment: 10, message: "I am long running! - still going..." }); |
| 22 | }, 1000); |
| 23 | |
| 24 | setTimeout(() => { |
| 25 | progress.report({ increment: 40, message: "I am long running! - still going even more..." }); |
| 26 | }, 2000); |
| 27 | |
| 28 | setTimeout(() => { |
| 29 | progress.report({ increment: 50, message: "I am long running! - almost there..." }); |
| 30 | }, 3000); |
| 31 | |
| 32 | const p = new Promise<void>(resolve => { |
| 33 | setTimeout(() => { |
| 34 | resolve(); |
| 35 | }, 5000); |
| 36 | }); |
| 37 | |
| 38 | return p; |
| 39 | }); |
| 40 | })); |
| 41 | } |
nothing calls this directly
no outgoing calls
no test coverage detected