diff options
author | Aleksey Kladov <[email protected]> | 2021-02-10 11:28:13 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-02-10 11:37:27 +0000 |
commit | 97166e2ad9307b3f4cca33d2c82149be9eb5a633 (patch) | |
tree | 8632550e4386b11b09deaacb38bf67929fe03f93 /editors/code/src/run.ts | |
parent | 36465b34b3b7f991ebf85680924acdb809b0494e (diff) |
Add **Copy Run Command Line** command for vscode
This is useful when you want to, e.g., run a specific test in a terminal
with `--release`.
Diffstat (limited to 'editors/code/src/run.ts')
-rw-r--r-- | editors/code/src/run.ts | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/editors/code/src/run.ts b/editors/code/src/run.ts index 17573cd82..f42baed16 100644 --- a/editors/code/src/run.ts +++ b/editors/code/src/run.ts | |||
@@ -128,13 +128,7 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise | |||
128 | throw `Unexpected runnable kind: ${runnable.kind}`; | 128 | throw `Unexpected runnable kind: ${runnable.kind}`; |
129 | } | 129 | } |
130 | 130 | ||
131 | const args = [...runnable.args.cargoArgs]; // should be a copy! | 131 | const args = createArgs(runnable); |
132 | if (runnable.args.cargoExtraArgs) { | ||
133 | args.push(...runnable.args.cargoExtraArgs); // Append user-specified cargo options. | ||
134 | } | ||
135 | if (runnable.args.executableArgs.length > 0) { | ||
136 | args.push('--', ...runnable.args.executableArgs); | ||
137 | } | ||
138 | 132 | ||
139 | const definition: tasks.CargoTaskDefinition = { | 133 | const definition: tasks.CargoTaskDefinition = { |
140 | type: tasks.TASK_TYPE, | 134 | type: tasks.TASK_TYPE, |
@@ -151,3 +145,14 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise | |||
151 | 145 | ||
152 | return cargoTask; | 146 | return cargoTask; |
153 | } | 147 | } |
148 | |||
149 | export function createArgs(runnable: ra.Runnable): string[] { | ||
150 | const args = [...runnable.args.cargoArgs]; // should be a copy! | ||
151 | if (runnable.args.cargoExtraArgs) { | ||
152 | args.push(...runnable.args.cargoExtraArgs); // Append user-specified cargo options. | ||
153 | } | ||
154 | if (runnable.args.executableArgs.length > 0) { | ||
155 | args.push('--', ...runnable.args.executableArgs); | ||
156 | } | ||
157 | return args; | ||
158 | } | ||