Skip to content

Commit 9d4ec99

Browse files
committed
Remove IWorkspaceContextService as dep on BackupService
The dep can't be fulfilled on main process
1 parent 69a6a18 commit 9d4ec99

2 files changed

Lines changed: 5 additions & 14 deletions

File tree

src/vs/platform/backup/node/backupService.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import * as crypto from 'crypto';
1010
import * as fs from 'original-fs';
1111
import * as arrays from 'vs/base/common/arrays';
1212
import Uri from 'vs/base/common/uri';
13-
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
1413
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
1514
import { IBackupService } from 'vs/platform/backup/common/backup';
1615

@@ -28,21 +27,12 @@ export class BackupService implements IBackupService {
2827
private fileContent: IBackupFormat;
2928

3029
constructor(
31-
@IEnvironmentService private environmentService: IEnvironmentService,
32-
@IWorkspaceContextService contextService?: IWorkspaceContextService
30+
@IEnvironmentService private environmentService: IEnvironmentService
3331
) {
34-
// IWorkspaceContextService will not exist on the main process
35-
if (!contextService) {
36-
return;
37-
}
38-
39-
// Hot exit is disabled for empty workspaces
40-
const workspace = contextService.getWorkspace();
41-
if (!workspace) {
42-
return;
43-
}
32+
}
4433

45-
this.workspaceResource = workspace.resource;
34+
public setCurrentWorkspace(resource: Uri): void {
35+
this.workspaceResource = resource;
4636
}
4737

4838
public getWorkspaceBackupPaths(): string[] {

src/vs/workbench/electron-browser/shell.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ export class WorkbenchShell {
247247

248248
// Backup
249249
const backupService = instantiationService.createInstance(BackupService);
250+
backupService.setCurrentWorkspace(this.contextService.getWorkspace().resource);
250251
serviceCollection.set(IBackupService, backupService);
251252

252253
// Storage

0 commit comments

Comments
 (0)