mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
Merge #2849
2849: Display vscode message after changing cargo-watch options r=edwin0cheng a=memoryruins Currently, changed cargo-watch settings do not go into effect until after a reload. This PR checks for changed `cargoWatchOptions` in the same way as the current `cargoFeatures` check. ![2020-01-14_20-52-20](https://user-images.githubusercontent.com/6868531/72398362-b5f5a300-3710-11ea-9bc1-9943bef08447.gif) Co-authored-by: memoryruins <memoryruinsmusic@gmail.com>
This commit is contained in:
commit
bc8be6bcdb
1 changed files with 16 additions and 0 deletions
|
@ -42,6 +42,7 @@ export class Config {
|
|||
|
||||
private prevEnhancedTyping: null | boolean = null;
|
||||
private prevCargoFeatures: null | CargoFeatures = null;
|
||||
private prevCargoWatchOptions: null | CargoWatchOptions = null;
|
||||
|
||||
constructor(ctx: vscode.ExtensionContext) {
|
||||
vscode.workspace.onDidChangeConfiguration(_ => this.refresh(), ctx.subscriptions);
|
||||
|
@ -174,6 +175,21 @@ export class Config {
|
|||
}
|
||||
this.prevCargoFeatures = { ...this.cargoFeatures };
|
||||
|
||||
if (this.prevCargoWatchOptions !== null) {
|
||||
const changed =
|
||||
this.cargoWatchOptions.enable !== this.prevCargoWatchOptions.enable ||
|
||||
this.cargoWatchOptions.command !== this.prevCargoWatchOptions.command ||
|
||||
this.cargoWatchOptions.allTargets !== this.prevCargoWatchOptions.allTargets ||
|
||||
this.cargoWatchOptions.arguments.length !== this.prevCargoWatchOptions.arguments.length ||
|
||||
this.cargoWatchOptions.arguments.some(
|
||||
(v, i) => v !== this.prevCargoWatchOptions!.arguments[i],
|
||||
);
|
||||
if (changed) {
|
||||
requireReloadMessage = 'Changing cargo-watch options requires a reload';
|
||||
}
|
||||
}
|
||||
this.prevCargoWatchOptions = { ...this.cargoWatchOptions };
|
||||
|
||||
if (requireReloadMessage !== null) {
|
||||
const reloadAction = 'Reload now';
|
||||
vscode.window
|
||||
|
|
Loading…
Reference in a new issue