Skip to content

Commit

Permalink
Fix #163383
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Apr 26, 2023
1 parent 2d34614 commit 9b265dc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/vs/workbench/api/common/extHostConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ export class ExtHostConfigProvider {
}
});
}
if (Array.isArray(target)) {
return deepClone(target);
}
return target;
};
result = cloneOnWriteProxy(result, key);
Expand Down
10 changes: 10 additions & 0 deletions src/vs/workbench/api/test/browser/extHostConfiguration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,16 @@ suite('ExtHostConfiguration', function () {
testObject.$acceptConfigurationChanged(newConfigData, configEventData);
});

test('get return instance of array value', function () {
const testObject = createExtHostConfiguration({ 'far': { 'boo': [] } });

const value: string[] = testObject.getConfiguration().get('far.boo', []);
value.push('a');

const actual = testObject.getConfiguration().get('far.boo', []);
assert.deepStrictEqual(actual, []);
});

function aWorkspaceFolder(uri: URI, index: number, name: string = ''): IWorkspaceFolder {
return new WorkspaceFolder({ uri, name, index });
}
Expand Down

0 comments on commit 9b265dc

Please sign in to comment.