Skip to content

Commit 0d3e7e6

Browse files
authored
1 parent ab301f9 commit 0d3e7e6

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

src/vs/workbench/services/extensionManagement/common/profileAwareExtensionManagementService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class NativeProfileAwareExtensionManagementService extends ExtensionManag
3131
private readonly _onDidChangeProfileExtensions = this._register(new Emitter<{ readonly added: ILocalExtension[]; readonly removed: ILocalExtension[] }>());
3232
readonly onDidChangeProfileExtensions = this._onDidChangeProfileExtensions.event;
3333

34-
constructor(channel: IChannel, private extensionsProfileResource: URI | undefined,
34+
constructor(channel: IChannel, public extensionsProfileResource: URI | undefined,
3535
@IUriIdentityService private readonly uriIdentityService: IUriIdentityService,
3636
) {
3737
super(channel);

src/vs/workbench/services/extensionManagement/electron-sandbox/extensionManagementServerService.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
1717
import { IUserDataProfileService } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
1818
import { NativeProfileAwareExtensionManagementService } from 'vs/workbench/services/extensionManagement/common/profileAwareExtensionManagementService';
1919
import { Disposable } from 'vs/base/common/lifecycle';
20+
import { IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile';
2021

2122
export class ExtensionManagementServerService extends Disposable implements IExtensionManagementServerService {
2223

@@ -30,12 +31,18 @@ export class ExtensionManagementServerService extends Disposable implements IExt
3031
@ISharedProcessService sharedProcessService: ISharedProcessService,
3132
@IRemoteAgentService remoteAgentService: IRemoteAgentService,
3233
@ILabelService labelService: ILabelService,
34+
@IUserDataProfilesService userDataProfilesService: IUserDataProfilesService,
3335
@IUserDataProfileService userDataProfileService: IUserDataProfileService,
3436
@IInstantiationService instantiationService: IInstantiationService,
3537
) {
3638
super();
3739
const localExtensionManagementService = this._register(instantiationService.createInstance(NativeProfileAwareExtensionManagementService, sharedProcessService.getChannel('extensions'), userDataProfileService.currentProfile.extensionsResource));
3840
this.localExtensionManagementServer = { extensionManagementService: localExtensionManagementService, id: 'local', label: localize('local', "Local") };
41+
this._register(userDataProfilesService.onDidChangeProfiles(e => {
42+
if (userDataProfileService.currentProfile.isDefault) {
43+
localExtensionManagementService.extensionsProfileResource = userDataProfilesService.defaultProfile.extensionsResource;
44+
}
45+
}));
3946
this._register(userDataProfileService.onDidChangeCurrentProfile(e => e.join(localExtensionManagementService.switchExtensionsProfile(e.profile.extensionsResource))));
4047
const remoteAgentConnection = remoteAgentService.getConnection();
4148
if (remoteAgentConnection) {

src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ export class UserDataProfileManagementService extends Disposable implements IUse
5555
private onDidChangeProfiles(e: DidChangeProfilesEvent): void {
5656
if (e.removed.some(profile => profile.id === this.userDataProfileService.currentProfile.id)) {
5757
this.enterProfile(this.userDataProfilesService.defaultProfile, false, localize('reload message when removed', "The current profile has been removed. Please reload to switch back to default profile"));
58+
return;
59+
}
60+
if (this.userDataProfileService.currentProfile.isDefault) {
61+
this.userDataProfileService.updateCurrentProfile(this.userDataProfilesService.defaultProfile, false);
62+
return;
5863
}
5964
}
6065

src/vs/workbench/services/userDataProfile/common/userDataProfileService.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ export class UserDataProfileService extends Disposable implements IUserDataProfi
2525
}
2626

2727
async updateCurrentProfile(userDataProfile: IUserDataProfile, preserveData: boolean): Promise<void> {
28-
if (this._currentProfile.id === userDataProfile.id) {
29-
return;
30-
}
3128
const previous = this._currentProfile;
3229
this._currentProfile = userDataProfile;
30+
if (this._currentProfile.id === previous.id) {
31+
return;
32+
}
3333
const joiners: Promise<void>[] = [];
3434
this._onDidChangeCurrentProfile.fire({
3535
preserveData,

0 commit comments

Comments
 (0)