aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/extension.ts
diff options
context:
space:
mode:
authorBernardo <[email protected]>2019-04-13 21:13:21 +0100
committerBernardo <[email protected]>2019-04-19 19:54:36 +0100
commit1ae6571762cab605a84a731e10c89d8f3f00eef8 (patch)
tree1b73640a2f9e2e2ee85d06cf56994ee6fe97a5f0 /editors/code/src/extension.ts
parent0d39b1c3fa03a8032ea96be922fd62710f811aba (diff)
cargo watch start and stop commands
Diffstat (limited to 'editors/code/src/extension.ts')
-rw-r--r--editors/code/src/extension.ts16
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';
2import * as lc from 'vscode-languageclient'; 2import * as lc from 'vscode-languageclient';
3 3
4import * as commands from './commands'; 4import * as commands from './commands';
5import { CargoWatchProvider } from './commands/cargo_watch';
5import { interactivelyStartCargoWatch } from './commands/runnables'; 6import { interactivelyStartCargoWatch } from './commands/runnables';
6import { SyntaxTreeContentProvider } from './commands/syntaxTree'; 7import { SyntaxTreeContentProvider } from './commands/syntaxTree';
7import * as events from './events'; 8import * 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();