aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/client.ts1
-rw-r--r--editors/code/src/commands/runnables.ts22
-rw-r--r--editors/code/src/main.ts1
-rw-r--r--editors/code/src/rust-analyzer-api.ts3
4 files changed, 24 insertions, 3 deletions
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts
index b2c830b30..d65454275 100644
--- a/editors/code/src/client.ts
+++ b/editors/code/src/client.ts
@@ -46,6 +46,7 @@ export async function createClient(config: Config, serverPath: string): Promise<
46 withSysroot: config.withSysroot, 46 withSysroot: config.withSysroot,
47 cargoFeatures: config.cargoFeatures, 47 cargoFeatures: config.cargoFeatures,
48 rustfmtArgs: config.rustfmtArgs, 48 rustfmtArgs: config.rustfmtArgs,
49 vscodeLldb: vscode.extensions.getExtension("vadimcn.vscode-lldb") != null,
49 }, 50 },
50 traceOutputChannel, 51 traceOutputChannel,
51 middleware: { 52 middleware: {
diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts
index 06b513466..357155163 100644
--- a/editors/code/src/commands/runnables.ts
+++ b/editors/code/src/commands/runnables.ts
@@ -62,6 +62,26 @@ export function runSingle(ctx: Ctx): Cmd {
62 }; 62 };
63} 63}
64 64
65export function debugSingle(ctx: Ctx): Cmd {
66 return async (config: ra.Runnable) => {
67 const editor = ctx.activeRustEditor;
68 if (!editor) return;
69
70 const debugConfig = {
71 type: "lldb",
72 request: "launch",
73 name: config.label,
74 cargo: {
75 args: config.args,
76 },
77 args: config.extraArgs,
78 cwd: config.cwd
79 };
80
81 return vscode.debug.startDebugging(undefined, debugConfig);
82 };
83}
84
65class RunnableQuickPick implements vscode.QuickPickItem { 85class RunnableQuickPick implements vscode.QuickPickItem {
66 public label: string; 86 public label: string;
67 public description?: string | undefined; 87 public description?: string | undefined;
@@ -87,7 +107,7 @@ function createTask(spec: ra.Runnable): vscode.Task {
87 type: 'cargo', 107 type: 'cargo',
88 label: spec.label, 108 label: spec.label,
89 command: spec.bin, 109 command: spec.bin,
90 args: spec.args, 110 args: spec.extraArgs ? [...spec.args, '--', ...spec.extraArgs] : spec.args,
91 env: spec.env, 111 env: spec.env,
92 }; 112 };
93 113
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index ecf53cf77..e01c89cc7 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -83,6 +83,7 @@ export async function activate(context: vscode.ExtensionContext) {
83 83
84 // Internal commands which are invoked by the server. 84 // Internal commands which are invoked by the server.
85 ctx.registerCommand('runSingle', commands.runSingle); 85 ctx.registerCommand('runSingle', commands.runSingle);
86 ctx.registerCommand('debugSingle', commands.debugSingle);
86 ctx.registerCommand('showReferences', commands.showReferences); 87 ctx.registerCommand('showReferences', commands.showReferences);
87 ctx.registerCommand('applySourceChange', commands.applySourceChange); 88 ctx.registerCommand('applySourceChange', commands.applySourceChange);
88 ctx.registerCommand('selectAndApplySourceChange', commands.selectAndApplySourceChange); 89 ctx.registerCommand('selectAndApplySourceChange', commands.selectAndApplySourceChange);
diff --git a/editors/code/src/rust-analyzer-api.ts b/editors/code/src/rust-analyzer-api.ts
index bd6e3ada0..e09a203c9 100644
--- a/editors/code/src/rust-analyzer-api.ts
+++ b/editors/code/src/rust-analyzer-api.ts
@@ -80,13 +80,12 @@ export interface Runnable {
80 label: string; 80 label: string;
81 bin: string; 81 bin: string;
82 args: Vec<string>; 82 args: Vec<string>;
83 extraArgs: Vec<string>;
83 env: FxHashMap<string, string>; 84 env: FxHashMap<string, string>;
84 cwd: Option<string>; 85 cwd: Option<string>;
85} 86}
86export const runnables = request<RunnablesParams, Vec<Runnable>>("runnables"); 87export const runnables = request<RunnablesParams, Vec<Runnable>>("runnables");
87 88
88
89
90export type InlayHint = InlayHint.TypeHint | InlayHint.ParamHint; 89export type InlayHint = InlayHint.TypeHint | InlayHint.ParamHint;
91 90
92export namespace InlayHint { 91export namespace InlayHint {