1- import { CancellationToken , commands , Disposable } from "vscode" ;
1+ import { commands , Disposable } from "vscode" ;
22import {
33 showAndLogExceptionWithTelemetry ,
44 showAndLogWarningMessage ,
@@ -7,12 +7,7 @@ import { extLogger } from "./common";
77import { asError , getErrorMessage , getErrorStack } from "./pure/helpers-pure" ;
88import { telemetryListener } from "./telemetry" ;
99import { redactableError } from "./pure/errors" ;
10- import {
11- UserCancellationException ,
12- withProgress ,
13- ProgressOptions ,
14- ProgressCallback ,
15- } from "./progress" ;
10+ import { UserCancellationException } from "./progress" ;
1611
1712/**
1813 * A task that handles command invocations from `commandRunner`.
@@ -24,27 +19,6 @@ import {
2419 */
2520export type NoProgressTask = ( ...args : any [ ] ) => Promise < any > ;
2621
27- /**
28- * A task that handles command invocations from `commandRunner`
29- * and includes a progress monitor.
30- *
31- *
32- * Arguments passed to the command handler are passed along,
33- * untouched to this `ProgressTaskWithArgs` instance.
34- *
35- * @param progress a progress handler function. Call this
36- * function with a `ProgressUpdate` instance in order to
37- * denote some progress being achieved on this task.
38- * @param token a cancellation token
39- * @param args arguments passed to this task passed on from
40- * `commands.registerCommand`.
41- */
42- type ProgressTaskWithArgs < R > = (
43- progress : ProgressCallback ,
44- token : CancellationToken ,
45- ...args : any [ ]
46- ) => Thenable < R > ;
47-
4822/**
4923 * A generic wrapper for command registration. This wrapper adds uniform error handling for commands.
5024 *
@@ -100,31 +74,3 @@ export function commandRunner(
10074 }
10175 } ) ;
10276}
103-
104- /**
105- * A generic wrapper for command registration. This wrapper adds uniform error handling,
106- * progress monitoring, and cancellation for commands.
107- *
108- * @param commandId The ID of the command to register.
109- * @param task The task to run. It is passed directly to `commands.registerCommand`. Any
110- * arguments to the command handler are passed on to the task after the progress callback
111- * and cancellation token.
112- * @param progressOptions Progress options to be sent to the progress monitor.
113- */
114- export function commandRunnerWithProgress < R > (
115- commandId : string ,
116- task : ProgressTaskWithArgs < R > ,
117- progressOptions : ProgressOptions ,
118- outputLogger = extLogger ,
119- ) : Disposable {
120- return commandRunner (
121- commandId ,
122- async ( ...args : any [ ] ) => {
123- return withProgress (
124- ( progress , token ) => task ( progress , token , ...args ) ,
125- progressOptions ,
126- ) ;
127- } ,
128- outputLogger ,
129- ) ;
130- }
0 commit comments