aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
authorIgor Matuszewski <[email protected]>2019-03-18 21:15:03 +0000
committerIgor Matuszewski <[email protected]>2019-03-18 21:15:03 +0000
commit5c3cc8c95f392c523bb638d78e0217780d6e8476 (patch)
tree2a39db2f3964ac2970423de2cf384e7d6adc415e /editors/code
parent7d2378ed7da7e2255e0ea155632a609909071ca7 (diff)
Reformat using Prettier
Diffstat (limited to 'editors/code')
-rw-r--r--editors/code/src/commands/runnables.ts10
-rw-r--r--editors/code/src/extension.ts42
2 files changed, 35 insertions, 17 deletions
diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts
index c6d23a185..23fd280b4 100644
--- a/editors/code/src/commands/runnables.ts
+++ b/editors/code/src/commands/runnables.ts
@@ -128,7 +128,7 @@ export const autoCargoWatchTask: vscode.Task = {
128 name: 'cargo watch', 128 name: 'cargo watch',
129 source: 'rust-analyzer', 129 source: 'rust-analyzer',
130 definition: { 130 definition: {
131 type: "dupa", 131 type: 'watch'
132 }, 132 },
133 execution: new vscode.ShellExecution('cargo', ['watch'], { cwd: '.' }), 133 execution: new vscode.ShellExecution('cargo', ['watch'], { cwd: '.' }),
134 134
@@ -138,8 +138,8 @@ export const autoCargoWatchTask: vscode.Task = {
138 clear: true 138 clear: true
139 }, 139 },
140 // Not yet exposed in the vscode.d.ts 140 // Not yet exposed in the vscode.d.ts
141 runOptions: { 141 // https://github.com/Microsoft/vscode/blob/ea7c31d770e04b51d586b0d3944f3a7feb03afb9/src/vs/workbench/contrib/tasks/common/tasks.ts#L444-L456
142 runOn: 2 // RunOnOptions.folderOpen, https://github.com/Microsoft/vscode/blob/ea7c31d770e04b51d586b0d3944f3a7feb03afb9/src/vs/workbench/contrib/tasks/common/tasks.ts#L444-L456 142 runOptions: ({
143 } as unknown as vscode.RunOptions, 143 runOn: 2 // RunOnOptions.folderOpen
144 144 } as unknown) as vscode.RunOptions
145}; 145};
diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts
index 442c9cd0d..f915a5023 100644
--- a/editors/code/src/extension.ts
+++ b/editors/code/src/extension.ts
@@ -92,11 +92,11 @@ export function activate(context: vscode.ExtensionContext) {
92 const allNotifications: Iterable< 92 const allNotifications: Iterable<
93 [string, lc.GenericNotificationHandler] 93 [string, lc.GenericNotificationHandler]
94 > = [ 94 > = [
95 [ 95 [
96 'rust-analyzer/publishDecorations', 96 'rust-analyzer/publishDecorations',
97 notifications.publishDecorations.handle 97 notifications.publishDecorations.handle
98 ] 98 ]
99 ]; 99 ];
100 const syntaxTreeContentProvider = new SyntaxTreeContentProvider(); 100 const syntaxTreeContentProvider = new SyntaxTreeContentProvider();
101 101
102 // The events below are plain old javascript events, triggered and handled by vscode 102 // The events below are plain old javascript events, triggered and handled by vscode
@@ -146,10 +146,17 @@ async function askToCargoWatch() {
146 return; 146 return;
147 } 147 }
148 148
149 const { stderr } = await util.promisify(exec)('cargo watch --version').catch(e => e); 149 const { stderr } = await util
150 .promisify(exec)('cargo watch --version')
151 .catch(e => e);
150 if (stderr.includes('no such subcommand: `watch`')) { 152 if (stderr.includes('no such subcommand: `watch`')) {
151 const msg = 'The `cargo-watch` subcommand is not installed. Install? (takes ~1-2 minutes)'; 153 const msg =
152 const install = await vscode.window.showInformationMessage(msg, 'yes', 'no'); 154 'The `cargo-watch` subcommand is not installed. Install? (takes ~1-2 minutes)';
155 const install = await vscode.window.showInformationMessage(
156 msg,
157 'yes',
158 'no'
159 );
153 if (install === 'no') { 160 if (install === 'no') {
154 return; 161 return;
155 } 162 }
@@ -160,15 +167,26 @@ async function askToCargoWatch() {
160 if (execution.task.name === label) { 167 if (execution.task.name === label) {
161 disposable.dispose(); 168 disposable.dispose();
162 resolve(); 169 resolve();
163 }; 170 }
164 }); 171 });
165 }); 172 });
166 173
167 vscode.tasks.executeTask(createTask({ label, bin: 'cargo', args: ['install', 'cargo-watch'], env: {} })); 174 vscode.tasks.executeTask(
175 createTask({
176 label,
177 bin: 'cargo',
178 args: ['install', 'cargo-watch'],
179 env: {}
180 })
181 );
168 await taskFinished; 182 await taskFinished;
169 const { stderr } = await util.promisify(exec)('cargo watch --version').catch(e => e); 183 const { stderr } = await util
184 .promisify(exec)('cargo watch --version')
185 .catch(e => e);
170 if (stderr !== '') { 186 if (stderr !== '') {
171 vscode.window.showErrorMessage(`Couldn't install \`cargo-\`watch: ${stderr}`); 187 vscode.window.showErrorMessage(
188 `Couldn't install \`cargo-\`watch: ${stderr}`
189 );
172 return; 190 return;
173 } 191 }
174 } 192 }