From 6ca5a1c352a6cc621d37b6b925911e9a052a88ba Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 26 Dec 2022 19:45:01 +0100 Subject: [PATCH] Fix #163243 (#170051) --- .../configuration/browser/configurationService.ts | 2 ++ .../test/browser/configurationService.test.ts | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/vs/workbench/services/configuration/browser/configurationService.ts b/src/vs/workbench/services/configuration/browser/configurationService.ts index 3bb6bc69024ab..c2498ed910f6b 100644 --- a/src/vs/workbench/services/configuration/browser/configurationService.ts +++ b/src/vs/workbench/services/configuration/browser/configurationService.ts @@ -782,6 +782,8 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat private onApplicationConfigurationChanged(applicationConfiguration: ConfigurationModel): void { const previous = { data: this._configuration.toData(), workspace: this.workspace }; const change = this._configuration.compareAndUpdateApplicationConfiguration(applicationConfiguration); + const configuraitonProperties = this.configurationRegistry.getConfigurationProperties(); + change.keys = change.keys.filter(key => configuraitonProperties[key]?.scope === ConfigurationScope.APPLICATION); this.triggerConfigurationChange(change, previous, ConfigurationTarget.USER); } diff --git a/src/vs/workbench/services/configuration/test/browser/configurationService.test.ts b/src/vs/workbench/services/configuration/test/browser/configurationService.test.ts index 4dc05d9500862..1fb15c5f72112 100644 --- a/src/vs/workbench/services/configuration/test/browser/configurationService.test.ts +++ b/src/vs/workbench/services/configuration/test/browser/configurationService.test.ts @@ -1671,6 +1671,19 @@ suite('WorkspaceConfigurationService - Profiles', () => { assert.strictEqual(testObject.getValue('configurationService.profiles.testSetting'), 'profileValue2'); })); + test('In non-default profile, changing application settings shall include only application scope settings in the change event', () => runWithFakedTimers({ useFakeTimers: true }, async () => { + await fileService.writeFile(instantiationService.get(IUserDataProfilesService).defaultProfile.settingsResource, VSBuffer.fromString('{}')); + await testObject.reloadConfiguration(); + + const promise = Event.toPromise(testObject.onDidChangeConfiguration); + await fileService.writeFile(instantiationService.get(IUserDataProfilesService).defaultProfile.settingsResource, VSBuffer.fromString('{ "configurationService.profiles.applicationSetting": "applicationValue", "configurationService.profiles.testSetting": "applicationValue" }')); + + const changeEvent = await promise; + assert.deepStrictEqual([...changeEvent.affectedKeys], ['configurationService.profiles.applicationSetting']); + assert.strictEqual(testObject.getValue('configurationService.profiles.applicationSetting'), 'applicationValue'); + assert.strictEqual(testObject.getValue('configurationService.profiles.testSetting'), 'isSet'); + })); + }); suite('WorkspaceConfigurationService-Multiroot', () => {