From 9b265dcea93c88d4396784f868f1d9379a62dee2 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 26 Apr 2023 20:03:02 +0200 Subject: [PATCH] Fix #163383 --- src/vs/workbench/api/common/extHostConfiguration.ts | 3 +++ .../api/test/browser/extHostConfiguration.test.ts | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/vs/workbench/api/common/extHostConfiguration.ts b/src/vs/workbench/api/common/extHostConfiguration.ts index 159a93d26b1c5..f3d7d2eb044c9 100644 --- a/src/vs/workbench/api/common/extHostConfiguration.ts +++ b/src/vs/workbench/api/common/extHostConfiguration.ts @@ -236,6 +236,9 @@ export class ExtHostConfigProvider { } }); } + if (Array.isArray(target)) { + return deepClone(target); + } return target; }; result = cloneOnWriteProxy(result, key); diff --git a/src/vs/workbench/api/test/browser/extHostConfiguration.test.ts b/src/vs/workbench/api/test/browser/extHostConfiguration.test.ts index a6dfdf8ccff89..8ba10f3b7fed7 100644 --- a/src/vs/workbench/api/test/browser/extHostConfiguration.test.ts +++ b/src/vs/workbench/api/test/browser/extHostConfiguration.test.ts @@ -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 }); }