diff options
Diffstat (limited to 'editors/code/src/extension.ts')
-rw-r--r-- | editors/code/src/extension.ts | 42 |
1 files changed, 30 insertions, 12 deletions
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 | } |