Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Jan 17, 2023
1 parent d5ab023 commit b5249e5
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
Expand Up @@ -753,6 +753,9 @@ export class WorkspaceService extends Disposable implements IWorkbenchConfigurat
if (this.workspace) {
const previousData = this._configuration.toData();
const change = this._configuration.compareAndUpdateDefaultConfiguration(configurationModel, properties);
if (this.applicationConfiguration) {
this._configuration.updateApplicationConfiguration(this.applicationConfiguration.reparse());
}
if (this.remoteUserConfiguration) {
this._configuration.updateLocalUserConfiguration(this.localUserConfiguration.reparse());
this._configuration.updateRemoteUserConfiguration(this.remoteUserConfiguration.reparse());
Expand Down
Expand Up @@ -1641,6 +1641,43 @@ suite('WorkspaceConfigurationService - Profiles', () => {
assert.strictEqual(testObject.getValue('configurationService.profiles.testSetting'), 'profileValue');
}));

test('registering normal setting after init', () => runWithFakedTimers<void>({ useFakeTimers: true }, async () => {
await fileService.writeFile(instantiationService.get(IUserDataProfilesService).defaultProfile.settingsResource, VSBuffer.fromString('{ "configurationService.profiles.testSetting3": "defaultProfile" }'));
await testObject.reloadConfiguration();

configurationRegistry.registerConfiguration({
'id': '_test',
'type': 'object',
'properties': {
'configurationService.profiles.testSetting3': {
'type': 'string',
'default': 'isSet',
}
}
});

assert.strictEqual(testObject.getValue('configurationService.profiles.testSetting3'), 'isSet');
}));

test('registering application scope setting after init', () => runWithFakedTimers<void>({ useFakeTimers: true }, async () => {
await fileService.writeFile(instantiationService.get(IUserDataProfilesService).defaultProfile.settingsResource, VSBuffer.fromString('{ "configurationService.profiles.applicationSetting3": "defaultProfile" }'));
await testObject.reloadConfiguration();

configurationRegistry.registerConfiguration({
'id': '_test',
'type': 'object',
'properties': {
'configurationService.profiles.applicationSetting3': {
'type': 'string',
'default': 'isSet',
scope: ConfigurationScope.APPLICATION
}
}
});

assert.strictEqual(testObject.getValue('configurationService.profiles.applicationSetting3'), 'defaultProfile');
}));

test('switch to default profile', () => runWithFakedTimers<void>({ useFakeTimers: true }, async () => {
await fileService.writeFile(instantiationService.get(IUserDataProfilesService).defaultProfile.settingsResource, VSBuffer.fromString('{ "configurationService.profiles.applicationSetting": "applicationValue", "configurationService.profiles.testSetting": "userValue" }'));
await fileService.writeFile(userDataProfileService.currentProfile.settingsResource, VSBuffer.fromString('{ "configurationService.profiles.applicationSetting": "profileValue", "configurationService.profiles.testSetting": "profileValue" }'));
Expand Down

0 comments on commit b5249e5

Please sign in to comment.