pull/191185/head
Sandeep Somavarapu 2023-08-24 09:35:08 +02:00 committed by GitHub
parent a0377f0c51
commit c4b5dff608
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 2 deletions

View File

@ -273,7 +273,7 @@ export class SettingsTreeSettingElement extends SettingsTreeElement {
}
private getTargetToInspect(setting: ISetting): SettingsTarget {
if (!this.userDataProfileService.currentProfile.isDefault) {
if (!this.userDataProfileService.currentProfile.isDefault && !this.userDataProfileService.currentProfile.useDefaultFlags?.settings) {
if (setting.scope === ConfigurationScope.APPLICATION) {
return ConfigurationTarget.APPLICATION;
}

View File

@ -47,7 +47,7 @@ import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/envir
import { workbenchConfigurationNodeBase } from 'vs/workbench/common/configuration';
function getLocalUserConfigurationScopes(userDataProfile: IUserDataProfile, hasRemote: boolean): ConfigurationScope[] | undefined {
return userDataProfile.isDefault
return (userDataProfile.isDefault || userDataProfile.useDefaultFlags?.settings)
? hasRemote ? LOCAL_MACHINE_SCOPES : undefined
: hasRemote ? LOCAL_MACHINE_PROFILE_SCOPES : PROFILE_SCOPES;
}

View File

@ -1774,6 +1774,22 @@ suite('WorkspaceConfigurationService - Profiles', () => {
assert.strictEqual(testObject.getValue('configurationService.profiles.testSetting'), 'profileValue2');
}));
test('switch to non default profile using settings from 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" }'));
await testObject.reloadConfiguration();
const profile = toUserDataProfile('custom3', 'custom3', joinPath(environmentService.userRoamingDataHome, 'profiles', 'custom2'), joinPath(environmentService.cacheHome, 'profilesCache'), { useDefaultFlags: { settings: true } }, instantiationService.get(IUserDataProfilesService).defaultProfile);
await fileService.writeFile(profile.settingsResource, VSBuffer.fromString('{ "configurationService.profiles.applicationSetting": "applicationValue2", "configurationService.profiles.testSetting": "profileValue2" }'));
const promise = Event.toPromise(testObject.onDidChangeConfiguration);
await userDataProfileService.updateCurrentProfile(profile);
const changeEvent = await promise;
assert.deepStrictEqual([...changeEvent.affectedKeys], ['configurationService.profiles.applicationSetting', 'configurationService.profiles.testSetting']);
assert.strictEqual(testObject.getValue('configurationService.profiles.applicationSetting'), 'applicationValue2');
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();