Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'editors/code/src/commands.ts')
| -rw-r--r-- | editors/code/src/commands.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts index ae94ecac6d..ee8fa2eb51 100644 --- a/editors/code/src/commands.ts +++ b/editors/code/src/commands.ts @@ -11,6 +11,7 @@ import { AstInspector } from "./ast_inspector"; import { isRustDocument, isCargoTomlDocument, sleep, isRustEditor } from "./util"; import { startDebugSession, makeDebugConfig } from "./debug"; import { LanguageClient } from "vscode-languageclient/node"; +import { LINKED_COMMANDS } from "./client"; export * from "./ast_inspector"; export * from "./run"; @@ -928,3 +929,13 @@ export function newDebugConfig(ctx: Ctx): Cmd { await makeDebugConfig(ctx, item.runnable); }; } + +export function linkToCommand(ctx: Ctx): Cmd { + return async (commandId: string) => { + const link = LINKED_COMMANDS.get(commandId); + if (ctx.client && link) { + const { command, arguments: args = [] } = link; + await vscode.commands.executeCommand(command, ...args); + } + }; +} |