diff options
Diffstat (limited to 'editors/code/src/extension.ts')
-rw-r--r-- | editors/code/src/extension.ts | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts index 1073a36a0..b48ad9b29 100644 --- a/editors/code/src/extension.ts +++ b/editors/code/src/extension.ts | |||
@@ -2,6 +2,7 @@ import * as vscode from 'vscode'; | |||
2 | import * as lc from 'vscode-languageclient'; | 2 | import * as lc from 'vscode-languageclient'; |
3 | 3 | ||
4 | import * as commands from './commands'; | 4 | import * as commands from './commands'; |
5 | import { CargoWatchProvider } from './commands/cargo_watch'; | ||
5 | import { interactivelyStartCargoWatch } from './commands/runnables'; | 6 | import { interactivelyStartCargoWatch } from './commands/runnables'; |
6 | import { SyntaxTreeContentProvider } from './commands/syntaxTree'; | 7 | import { SyntaxTreeContentProvider } from './commands/syntaxTree'; |
7 | import * as events from './events'; | 8 | import * as events from './events'; |
@@ -126,7 +127,20 @@ export function activate(context: vscode.ExtensionContext) { | |||
126 | vscode.commands.registerCommand('rust-analyzer.reload', reloadCommand); | 127 | vscode.commands.registerCommand('rust-analyzer.reload', reloadCommand); |
127 | 128 | ||
128 | // Executing `cargo watch` provides us with inline diagnostics on save | 129 | // Executing `cargo watch` provides us with inline diagnostics on save |
129 | interactivelyStartCargoWatch(context); | 130 | let provider: CargoWatchProvider | undefined; |
131 | interactivelyStartCargoWatch(context).then(p => { | ||
132 | provider = p; | ||
133 | }); | ||
134 | registerCommand('rust-analyzer.startCargoWatch', () => { | ||
135 | if (provider) { | ||
136 | provider.start(); | ||
137 | } | ||
138 | }); | ||
139 | registerCommand('rust-analyzer.stopCargoWatch', () => { | ||
140 | if (provider) { | ||
141 | provider.stop(); | ||
142 | } | ||
143 | }); | ||
130 | 144 | ||
131 | // Start the language server, finally! | 145 | // Start the language server, finally! |
132 | startServer(); | 146 | startServer(); |