mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
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:
commit
82a1b91f20
4 changed files with 31 additions and 8 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue