浏览代码

Avoids writing settings if not needed

main
Eric Amodio 5 年前
父节点
当前提交
cf9c7b7847
共有 1 个文件被更改,包括 14 次插入6 次删除
  1. +14
    -6
      src/webviews/webviewBase.ts

+ 14
- 6
src/webviews/webviewBase.ts 查看文件

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

正在加载...
取消
保存