Browse Source

Avoids writing settings if not needed

main
Eric Amodio 5 years ago
parent
commit
cf9c7b7847
1 changed files with 14 additions and 6 deletions
  1. +14
    -6
      src/webviews/webviewBase.ts

+ 14
- 6
src/webviews/webviewBase.ts View File

@ -100,12 +100,20 @@ export abstract class WebviewBase implements Disposable {
for (const key in params.changes) {
const inspect = configuration.inspect(key as any)!;
const value = params.changes[key];
void (await configuration.update(
key as any,
value === inspect.defaultValue ? undefined : value,
target
));
let value = params.changes[key];
if (value !== undefined) {
if (params.scope === 'workspace') {
if (value === inspect.workspaceValue) continue;
} else {
if (value === inspect.globalValue && value !== inspect.defaultValue) continue;
if (value === inspect.defaultValue) {
value = undefined;
}
}
}
void (await configuration.update(key as any, value, target));
}
for (const key of params.removes) {

Loading…
Cancel
Save