Skip to content

Commit f89c103

Browse files
authored
storage - 💄 (microsoft#154230)
1 parent 0b07495 commit f89c103

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

src/vs/platform/storage/electron-sandbox/storageService.ts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,24 @@ import { IAnyWorkspaceIdentifier, IEmptyWorkspaceIdentifier, ISingleFolderWorksp
1616

1717
export class NativeStorageService extends AbstractStorageService {
1818

19-
private readonly applicationStorage: IStorage;
20-
private readonly applicationStorageProfile: IUserDataProfile;
19+
private readonly applicationStorageProfile = this.initialProfiles.defaultProfile;
20+
private readonly applicationStorage = this.createApplicationStorage();
2121

22-
private profileStorage: IStorage;
23-
private profileStorageProfile: IUserDataProfile | undefined = undefined;
22+
private profileStorageProfile = this.initialProfiles.currentProfile;
2423
private readonly profileStorageDisposables = this._register(new DisposableStore());
24+
private profileStorage = this.createProfileStorage(this.profileStorageProfile);
2525

26-
private workspaceStorage: IStorage | undefined = undefined;
27-
private workspaceStorageId: string | undefined = undefined;
26+
private workspaceStorageId = this.initialWorkspace?.id;
2827
private readonly workspaceStorageDisposables = this._register(new DisposableStore());
28+
private workspaceStorage = this.createWorkspaceStorage(this.initialWorkspace);
2929

3030
constructor(
31-
workspace: IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | IEmptyWorkspaceIdentifier | undefined,
32-
{ defaultProfile, currentProfile }: { defaultProfile: IUserDataProfile; currentProfile: IUserDataProfile },
31+
private readonly initialWorkspace: IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | IEmptyWorkspaceIdentifier | undefined,
32+
private readonly initialProfiles: { defaultProfile: IUserDataProfile; currentProfile: IUserDataProfile },
3333
private readonly mainProcessService: IMainProcessService,
3434
private readonly environmentService: IEnvironmentService
3535
) {
3636
super();
37-
38-
this.applicationStorageProfile = defaultProfile;
39-
40-
this.applicationStorage = this.createApplicationStorage();
41-
this.profileStorage = this.createProfileStorage(currentProfile);
42-
this.workspaceStorage = this.createWorkspaceStorage(workspace);
4337
}
4438

4539
private createApplicationStorage(): IStorage {
@@ -148,7 +142,7 @@ export class NativeStorageService extends AbstractStorageService {
148142
}
149143

150144
protected async switchToProfile(toProfile: IUserDataProfile, preserveData: boolean): Promise<void> {
151-
if (this.profileStorageProfile && !this.canSwitchProfile(this.profileStorageProfile, toProfile)) {
145+
if (!this.canSwitchProfile(this.profileStorageProfile, toProfile)) {
152146
return;
153147
}
154148

src/vs/workbench/services/storage/browser/storageService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export class BrowserStorageService extends AbstractStorageService {
166166
}
167167

168168
protected async switchToProfile(toProfile: IUserDataProfile, preserveData: boolean): Promise<void> {
169-
if (this.profileStorageProfile && !this.canSwitchProfile(this.profileStorageProfile, toProfile)) {
169+
if (!this.canSwitchProfile(this.profileStorageProfile, toProfile)) {
170170
return;
171171
}
172172

0 commit comments

Comments
 (0)