Skip to content

Commit

Permalink
simplify code for demo (#180932)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 authored Apr 26, 2023
1 parent 7d76d94 commit 5c9860c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/vs/workbench/api/common/extHostConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ export class ExtHostConfigProvider {
} else {
let clonedConfig: any | undefined = undefined;
const cloneOnWriteProxy = (target: any, accessor: string): any => {
let clonedTarget: any | undefined = undefined;
const cloneTarget = () => {
clonedConfig = clonedConfig ? clonedConfig : deepClone(config);
clonedTarget = clonedTarget ? clonedTarget : lookUp(clonedConfig, accessor);
};
return isObject(target) ?
new Proxy(target, {
if (isObject(target)) {
let clonedTarget: any | undefined = undefined;
const cloneTarget = () => {
clonedConfig = clonedConfig ? clonedConfig : deepClone(config);
clonedTarget = clonedTarget ? clonedTarget : lookUp(clonedConfig, accessor);
};
return new Proxy(target, {
get: (target: any, property: PropertyKey) => {
if (typeof property === 'string' && property.toLowerCase() === 'tojson') {
cloneTarget();
Expand Down Expand Up @@ -234,7 +234,9 @@ export class ExtHostConfigProvider {
}
return true;
}
}) : target;
});
}
return target;
};
result = cloneOnWriteProxy(result, key);
}
Expand Down

0 comments on commit 5c9860c

Please sign in to comment.