Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 authored Dec 26, 2022
1 parent 4205170 commit 6ca5a1c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>({ 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', () => {
Expand Down

0 comments on commit 6ca5a1c

Please sign in to comment.