Merge #7625
7625: Add **Copy Run Command Line** command for vscode r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
@@ -5,7 +5,7 @@ import * as ra from './lsp_ext';
|
||||
import { Ctx, Cmd } from './ctx';
|
||||
import { applySnippetWorkspaceEdit, applySnippetTextEdits } from './snippets';
|
||||
import { spawnSync } from 'child_process';
|
||||
import { RunnableQuickPick, selectRunnable, createTask } from './run';
|
||||
import { RunnableQuickPick, selectRunnable, createTask, createArgs } from './run';
|
||||
import { AstInspector } from './ast_inspector';
|
||||
import { isRustDocument, sleep, isRustEditor } from './util';
|
||||
import { startDebugSession, makeDebugConfig } from './debug';
|
||||
@@ -572,6 +572,18 @@ export function runSingle(ctx: Ctx): Cmd {
|
||||
};
|
||||
}
|
||||
|
||||
export function copyRunCommandLine(ctx: Ctx) {
|
||||
let prevRunnable: RunnableQuickPick | undefined;
|
||||
return async () => {
|
||||
const item = await selectRunnable(ctx, prevRunnable);
|
||||
if (!item) return;
|
||||
const args = createArgs(item.runnable);
|
||||
const commandLine = ["cargo", ...args].join(" ");
|
||||
await vscode.env.clipboard.writeText(commandLine);
|
||||
await vscode.window.showInformationMessage("Cargo invocation copied to the clipboard.");
|
||||
};
|
||||
}
|
||||
|
||||
export function debug(ctx: Ctx): Cmd {
|
||||
let prevDebuggee: RunnableQuickPick | undefined;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user