mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
cargo watch start and stop commands
This commit is contained in:
parent
0d39b1c3fa
commit
1ae6571762
5 changed files with 99 additions and 54 deletions
|
@ -2,6 +2,7 @@ import * as vscode from 'vscode';
|
|||
import * as lc from 'vscode-languageclient';
|
||||
|
||||
import * as commands from './commands';
|
||||
import { CargoWatchProvider } from './commands/cargo_watch';
|
||||
import { interactivelyStartCargoWatch } from './commands/runnables';
|
||||
import { SyntaxTreeContentProvider } from './commands/syntaxTree';
|
||||
import * as events from './events';
|
||||
|
@ -126,7 +127,20 @@ export function activate(context: vscode.ExtensionContext) {
|
|||
vscode.commands.registerCommand('rust-analyzer.reload', reloadCommand);
|
||||
|
||||
// Executing `cargo watch` provides us with inline diagnostics on save
|
||||
interactivelyStartCargoWatch(context);
|
||||
let provider: CargoWatchProvider | undefined;
|
||||
interactivelyStartCargoWatch(context).then(p => {
|
||||
provider = p;
|
||||
});
|
||||
registerCommand('rust-analyzer.startCargoWatch', () => {
|
||||
if (provider) {
|
||||
provider.start();
|
||||
}
|
||||
});
|
||||
registerCommand('rust-analyzer.stopCargoWatch', () => {
|
||||
if (provider) {
|
||||
provider.stop();
|
||||
}
|
||||
});
|
||||
|
||||
// Start the language server, finally!
|
||||
startServer();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue