diff options
Diffstat (limited to 'extensions/markdown-language-features/src/commandManager.ts')
-rw-r--r-- | extensions/markdown-language-features/src/commandManager.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/extensions/markdown-language-features/src/commandManager.ts b/extensions/markdown-language-features/src/commandManager.ts index 359d5b9ca96..86609dbe2b2 100644 --- a/extensions/markdown-language-features/src/commandManager.ts +++ b/extensions/markdown-language-features/src/commandManager.ts @@ -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)); } -}
\ No newline at end of file +} |