mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 20:13:32 +01:00
@@ -21,9 +21,11 @@ export class CommandManager {
|
||||
this.commands.clear();
|
||||
}
|
||||
|
||||
public register<T extends Command>(command: T): T {
|
||||
public register<T extends Command>(command: T): vscode.Disposable {
|
||||
this.registerCommand(command.id, command.execute, command);
|
||||
return command;
|
||||
return new vscode.Disposable(() => {
|
||||
this.commands.delete(command.id);
|
||||
});
|
||||
}
|
||||
|
||||
private registerCommand(id: string, impl: (...args: any[]) => void, thisArg?: any) {
|
||||
@@ -33,4 +35,4 @@ export class CommandManager {
|
||||
|
||||
this.commands.set(id, vscode.commands.registerCommand(id, impl, thisArg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user