aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands/runnables.ts
diff options
context:
space:
mode:
authorLaurenČ›iu Nicola <[email protected]>2019-12-09 18:57:55 +0000
committerLaurenČ›iu Nicola <[email protected]>2019-12-09 19:07:19 +0000
commit273299693b85996878907ad256ed55f072ec3f1a (patch)
tree16d7de77952895b4cebf1cbb7a18652eaf4d98b6 /editors/code/src/commands/runnables.ts
parent897b550049d8889804bb476e305427d07879cd63 (diff)
Code: enable prettier trailing commas
Diffstat (limited to 'editors/code/src/commands/runnables.ts')
-rw-r--r--editors/code/src/commands/runnables.ts36
1 files changed, 18 insertions, 18 deletions
diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts
index ac59bf60d..9b1c6643d 100644
--- a/editors/code/src/commands/runnables.ts
+++ b/editors/code/src/commands/runnables.ts
@@ -46,17 +46,17 @@ function createTask(spec: Runnable): vscode.Task {
46 label: spec.label, 46 label: spec.label,
47 command: spec.bin, 47 command: spec.bin,
48 args: spec.args, 48 args: spec.args,
49 env: spec.env 49 env: spec.env,
50 }; 50 };
51 51
52 const execOption: vscode.ShellExecutionOptions = { 52 const execOption: vscode.ShellExecutionOptions = {
53 cwd: spec.cwd || '.', 53 cwd: spec.cwd || '.',
54 env: definition.env 54 env: definition.env,
55 }; 55 };
56 const exec = new vscode.ShellExecution( 56 const exec = new vscode.ShellExecution(
57 definition.command, 57 definition.command,
58 definition.args, 58 definition.args,
59 execOption 59 execOption,
60 ); 60 );
61 61
62 const f = vscode.workspace.workspaceFolders![0]; 62 const f = vscode.workspace.workspaceFolders![0];
@@ -66,7 +66,7 @@ function createTask(spec: Runnable): vscode.Task {
66 definition.label, 66 definition.label,
67 TASK_SOURCE, 67 TASK_SOURCE,
68 exec, 68 exec,
69 ['$rustc'] 69 ['$rustc'],
70 ); 70 );
71 t.presentationOptions.clear = true; 71 t.presentationOptions.clear = true;
72 return t; 72 return t;
@@ -79,17 +79,17 @@ export async function handle() {
79 return; 79 return;
80 } 80 }
81 const textDocument: lc.TextDocumentIdentifier = { 81 const textDocument: lc.TextDocumentIdentifier = {
82 uri: editor.document.uri.toString() 82 uri: editor.document.uri.toString(),
83 }; 83 };
84 const params: RunnablesParams = { 84 const params: RunnablesParams = {
85 textDocument, 85 textDocument,
86 position: Server.client.code2ProtocolConverter.asPosition( 86 position: Server.client.code2ProtocolConverter.asPosition(
87 editor.selection.active 87 editor.selection.active,
88 ) 88 ),
89 }; 89 };
90 const runnables = await Server.client.sendRequest<Runnable[]>( 90 const runnables = await Server.client.sendRequest<Runnable[]>(
91 'rust-analyzer/runnables', 91 'rust-analyzer/runnables',
92 params 92 params,
93 ); 93 );
94 const items: RunnableQuickPick[] = []; 94 const items: RunnableQuickPick[] = [];
95 if (prevRunnable) { 95 if (prevRunnable) {
@@ -124,7 +124,7 @@ export async function handleSingle(runnable: Runnable) {
124 task.presentationOptions = { 124 task.presentationOptions = {
125 reveal: vscode.TaskRevealKind.Always, 125 reveal: vscode.TaskRevealKind.Always,
126 panel: vscode.TaskPanelKind.Dedicated, 126 panel: vscode.TaskPanelKind.Dedicated,
127 clear: true 127 clear: true,
128 }; 128 };
129 129
130 return vscode.tasks.executeTask(task); 130 return vscode.tasks.executeTask(task);
@@ -136,7 +136,7 @@ export async function handleSingle(runnable: Runnable) {
136 * that, when accepted, allow us to `cargo install cargo-watch` and then run it. 136 * that, when accepted, allow us to `cargo install cargo-watch` and then run it.
137 */ 137 */
138export async function interactivelyStartCargoWatch( 138export async function interactivelyStartCargoWatch(
139 context: vscode.ExtensionContext 139 context: vscode.ExtensionContext,
140): Promise<CargoWatchProvider | undefined> { 140): Promise<CargoWatchProvider | undefined> {
141 if (Server.config.cargoWatchOptions.enableOnStartup === 'disabled') { 141 if (Server.config.cargoWatchOptions.enableOnStartup === 'disabled') {
142 return; 142 return;
@@ -146,7 +146,7 @@ export async function interactivelyStartCargoWatch(
146 const watch = await vscode.window.showInformationMessage( 146 const watch = await vscode.window.showInformationMessage(
147 'Start watching changes with cargo? (Executes `cargo watch`, provides inline diagnostics)', 147 'Start watching changes with cargo? (Executes `cargo watch`, provides inline diagnostics)',
148 'yes', 148 'yes',
149 'no' 149 'no',
150 ); 150 );
151 if (watch !== 'yes') { 151 if (watch !== 'yes') {
152 return; 152 return;
@@ -157,12 +157,12 @@ export async function interactivelyStartCargoWatch(
157} 157}
158 158
159export async function startCargoWatch( 159export async function startCargoWatch(
160 context: vscode.ExtensionContext 160 context: vscode.ExtensionContext,
161): Promise<CargoWatchProvider | undefined> { 161): Promise<CargoWatchProvider | undefined> {
162 const execPromise = util.promisify(child_process.exec); 162 const execPromise = util.promisify(child_process.exec);
163 163
164 const { stderr, code = 0 } = await execPromise( 164 const { stderr, code = 0 } = await execPromise(
165 'cargo watch --version' 165 'cargo watch --version',
166 ).catch(e => e); 166 ).catch(e => e);
167 167
168 if (stderr.includes('no such subcommand: `watch`')) { 168 if (stderr.includes('no such subcommand: `watch`')) {
@@ -171,7 +171,7 @@ export async function startCargoWatch(
171 const install = await vscode.window.showInformationMessage( 171 const install = await vscode.window.showInformationMessage(
172 msg, 172 msg,
173 'yes', 173 'yes',
174 'no' 174 'no',
175 ); 175 );
176 if (install !== 'yes') { 176 if (install !== 'yes') {
177 return; 177 return;
@@ -192,20 +192,20 @@ export async function startCargoWatch(
192 label, 192 label,
193 bin: 'cargo', 193 bin: 'cargo',
194 args: ['install', 'cargo-watch'], 194 args: ['install', 'cargo-watch'],
195 env: {} 195 env: {},
196 }) 196 }),
197 ); 197 );
198 await taskFinished; 198 await taskFinished;
199 const output = await execPromise('cargo watch --version').catch(e => e); 199 const output = await execPromise('cargo watch --version').catch(e => e);
200 if (output.stderr !== '') { 200 if (output.stderr !== '') {
201 vscode.window.showErrorMessage( 201 vscode.window.showErrorMessage(
202 `Couldn't install \`cargo-\`watch: ${output.stderr}` 202 `Couldn't install \`cargo-\`watch: ${output.stderr}`,
203 ); 203 );
204 return; 204 return;
205 } 205 }
206 } else if (code !== 0) { 206 } else if (code !== 0) {
207 vscode.window.showErrorMessage( 207 vscode.window.showErrorMessage(
208 `\`cargo watch\` failed with ${code}: ${stderr}` 208 `\`cargo watch\` failed with ${code}: ${stderr}`,
209 ); 209 );
210 return; 210 return;
211 } 211 }