From edb820c3293142b034a20f4502192080fe74072a Mon Sep 17 00:00:00 2001 From: memoryruins Date: Tue, 14 Jan 2020 20:52:48 -0500 Subject: Display vscode message after changing cargo-watch options --- editors/code/src/config.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index ec2790b63..c6d5fc4af 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -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); @@ -173,6 +174,24 @@ export class Config { requireReloadMessage = 'Changing cargo features requires a reload'; } this.prevCargoFeatures = { ...this.cargoFeatures }; + + if ( + this.prevCargoWatchOptions !== null && + (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], + )) + ) { + requireReloadMessage = 'Changing cargo-watch options requires a reload'; + } + this.prevCargoWatchOptions = { ...this.cargoWatchOptions }; if (requireReloadMessage !== null) { const reloadAction = 'Reload now'; -- cgit v1.2.3 From 896a162f5591f632ed457aa3a34335460755eb68 Mon Sep 17 00:00:00 2001 From: memoryruins Date: Tue, 14 Jan 2020 22:52:49 -0500 Subject: Improve readability --- editors/code/src/config.ts | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index c6d5fc4af..fc21c8813 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -174,22 +174,19 @@ export class Config { requireReloadMessage = 'Changing cargo features requires a reload'; } this.prevCargoFeatures = { ...this.cargoFeatures }; - - if ( - this.prevCargoWatchOptions !== null && - (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 || + + 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], - )) - ) { - requireReloadMessage = 'Changing cargo-watch options requires a reload'; + ); + if (changed) { + requireReloadMessage = 'Changing cargo-watch options requires a reload'; + } } this.prevCargoWatchOptions = { ...this.cargoWatchOptions }; -- cgit v1.2.3