diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-01-15 04:00:52 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-01-15 04:00:52 +0000 |
commit | bc8be6bcdb7ea9b23cc6723769e6071a705cb88b (patch) | |
tree | 48d36e0c6a367de2a28e43e69f85ab3d05ed2e67 /editors/code/src | |
parent | 754d9d1a0c3551b01126e8e88d1fc3ff45ca695d (diff) | |
parent | 896a162f5591f632ed457aa3a34335460755eb68 (diff) |
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 <[email protected]>
Diffstat (limited to 'editors/code/src')
-rw-r--r-- | editors/code/src/config.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index ec2790b63..fc21c8813 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts | |||
@@ -42,6 +42,7 @@ export class Config { | |||
42 | 42 | ||
43 | private prevEnhancedTyping: null | boolean = null; | 43 | private prevEnhancedTyping: null | boolean = null; |
44 | private prevCargoFeatures: null | CargoFeatures = null; | 44 | private prevCargoFeatures: null | CargoFeatures = null; |
45 | private prevCargoWatchOptions: null | CargoWatchOptions = null; | ||
45 | 46 | ||
46 | constructor(ctx: vscode.ExtensionContext) { | 47 | constructor(ctx: vscode.ExtensionContext) { |
47 | vscode.workspace.onDidChangeConfiguration(_ => this.refresh(), ctx.subscriptions); | 48 | vscode.workspace.onDidChangeConfiguration(_ => this.refresh(), ctx.subscriptions); |
@@ -174,6 +175,21 @@ export class Config { | |||
174 | } | 175 | } |
175 | this.prevCargoFeatures = { ...this.cargoFeatures }; | 176 | this.prevCargoFeatures = { ...this.cargoFeatures }; |
176 | 177 | ||
178 | if (this.prevCargoWatchOptions !== null) { | ||
179 | const changed = | ||
180 | this.cargoWatchOptions.enable !== this.prevCargoWatchOptions.enable || | ||
181 | this.cargoWatchOptions.command !== this.prevCargoWatchOptions.command || | ||
182 | this.cargoWatchOptions.allTargets !== this.prevCargoWatchOptions.allTargets || | ||
183 | this.cargoWatchOptions.arguments.length !== this.prevCargoWatchOptions.arguments.length || | ||
184 | this.cargoWatchOptions.arguments.some( | ||
185 | (v, i) => v !== this.prevCargoWatchOptions!.arguments[i], | ||
186 | ); | ||
187 | if (changed) { | ||
188 | requireReloadMessage = 'Changing cargo-watch options requires a reload'; | ||
189 | } | ||
190 | } | ||
191 | this.prevCargoWatchOptions = { ...this.cargoWatchOptions }; | ||
192 | |||
177 | if (requireReloadMessage !== null) { | 193 | if (requireReloadMessage !== null) { |
178 | const reloadAction = 'Reload now'; | 194 | const reloadAction = 'Reload now'; |
179 | vscode.window | 195 | vscode.window |