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:
bors[bot] 2020-01-15 04:00:52 +00:00 committed by GitHub
commit bc8be6bcdb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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