@@ -583,6 +583,70 @@ index a1c3e50ffd..910627aaf9 100644
583
583
if (module.scheme !== Schemas.file) {
584
584
throw new Error(`Cannot load URI: '${module}', must be of file-scheme`);
585
585
}
586
+ diff --git a/src/vs/workbench/api/node/extHostStoragePaths.ts b/src/vs/workbench/api/node/extHostStoragePaths.ts
587
+ index afdd6bf398..ac91318ce3 100644
588
+ --- a/src/vs/workbench/api/node/extHostStoragePaths.ts
589
+ +++ b/src/vs/workbench/api/node/extHostStoragePaths.ts
590
+ @@ -5,13 +5,14 @@
591
+
592
+ import * as path from 'vs/base/common/path';
593
+ import { URI } from 'vs/base/common/uri';
594
+ - import * as pfs from 'vs/base/node/pfs';
595
+ - import { IEnvironment, IStaticWorkspaceData } from 'vs/workbench/api/common/extHost.protocol';
596
+ + import { IEnvironment, IStaticWorkspaceData, MainContext } from 'vs/workbench/api/common/extHost.protocol';
597
+ import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
598
+ import { IExtensionStoragePaths } from 'vs/workbench/api/common/extHostStoragePaths';
599
+ import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService';
600
+ import { withNullAsUndefined } from 'vs/base/common/types';
601
+ import { ILogService } from 'vs/platform/log/common/log';
602
+ + import { IExtHostRpcService } from '../common/extHostRpcService';
603
+ + import { VSBuffer } from 'vs/base/common/buffer';
604
+
605
+ export class ExtensionStoragePaths implements IExtensionStoragePaths {
606
+
607
+ @@ -26,6 +27,7 @@ export class ExtensionStoragePaths implements IExtensionStoragePaths {
608
+ constructor(
609
+ @IExtHostInitDataService initData: IExtHostInitDataService,
610
+ @ILogService private readonly _logService: ILogService,
611
+ + @IExtHostRpcService private readonly _extHostRpc: IExtHostRpcService,
612
+ ) {
613
+ this._workspace = withNullAsUndefined(initData.workspace);
614
+ this._environment = initData.environment;
615
+ @@ -54,21 +56,25 @@ export class ExtensionStoragePaths implements IExtensionStoragePaths {
616
+ const storageName = this._workspace.id;
617
+ const storagePath = path.join(this._environment.appSettingsHome.fsPath, 'workspaceStorage', storageName);
618
+
619
+ - const exists = await pfs.dirExists(storagePath);
620
+ + // NOTE@coder: Use the file system proxy so this will work in the browser.
621
+ + // writeFile performs a mkdirp so we don't need to bother ourselves.
622
+ + const fileSystem = this._extHostRpc.getProxy(MainContext.MainThreadFileSystem);
623
+ + const exists = fileSystem.$stat(URI.file(storagePath))
624
+
625
+ if (exists) {
626
+ return storagePath;
627
+ }
628
+
629
+ try {
630
+ - await pfs.mkdirp(storagePath);
631
+ - await pfs.writeFile(
632
+ - path.join(storagePath, 'meta.json'),
633
+ - JSON.stringify({
634
+ - id: this._workspace.id,
635
+ - configuration: this._workspace.configuration && URI.revive(this._workspace.configuration).toString(),
636
+ - name: this._workspace.name
637
+ - }, undefined, 2)
638
+ + await fileSystem.$writeFile(
639
+ + URI.file(path.join(storagePath, 'meta.json')),
640
+ + VSBuffer.fromString(
641
+ + JSON.stringify({
642
+ + id: this._workspace.id,
643
+ + configuration: this._workspace.configuration && URI.revive(this._workspace.configuration).toString(),
644
+ + name: this._workspace.name
645
+ + }, undefined, 2)
646
+ + )
647
+ );
648
+ return storagePath;
649
+
586
650
diff --git a/src/vs/workbench/api/worker/extHostExtensionService.ts b/src/vs/workbench/api/worker/extHostExtensionService.ts
587
651
index 4781f22676..25143a97c0 100644
588
652
--- a/src/vs/workbench/api/worker/extHostExtensionService.ts
@@ -771,25 +835,49 @@ index 0f35c54431..32fff09b18 100644
771
835
}
772
836
}
773
837
diff --git a/src/vs/workbench/services/extensions/worker/extHost.services.ts b/src/vs/workbench/services/extensions/worker/extHost.services.ts
774
- index 8a65101aa4..80cedfdf57 100644
838
+ index 8a65101aa4..e9c66b3b20 100644
775
839
--- a/src/vs/workbench/services/extensions/worker/extHost.services.ts
776
840
+++ b/src/vs/workbench/services/extensions/worker/extHost.services.ts
777
- @@ -21,6 +21,7 @@ import { ExtHostExtensionService } from 'vs/workbench/api/worker/extHostExtensio
778
- import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
841
+ @@ -18,9 +18,10 @@ import { IExtensionStoragePaths } from 'vs/workbench/api/common/extHostStoragePa
842
+ import { IExtHostExtensionService } from 'vs/workbench/api/common/extHostExtensionService';
843
+ import { IExtHostStorage, ExtHostStorage } from 'vs/workbench/api/common/extHostStorage';
844
+ import { ExtHostExtensionService } from 'vs/workbench/api/worker/extHostExtensionService';
845
+ - import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
779
846
import { ILogService } from 'vs/platform/log/common/log';
780
847
import { ExtHostLogService } from 'vs/workbench/api/worker/extHostLogService';
781
848
+ import { ExtHostNodeProxy, IExtHostNodeProxy } from 'vs/server/src/browser/extHostNodeProxy';
849
+ + import { ExtensionStoragePaths } from 'vs/workbench/api/node/extHostStoragePaths';
782
850
783
851
// register singleton services
784
852
registerSingleton(ILogService, ExtHostLogService);
785
- @@ -33,6 +34,7 @@ registerSingleton(IExtHostDocumentsAndEditors, ExtHostDocumentsAndEditors);
853
+ @@ -33,25 +34,9 @@ registerSingleton(IExtHostDocumentsAndEditors, ExtHostDocumentsAndEditors);
786
854
registerSingleton(IExtHostStorage, ExtHostStorage);
787
855
registerSingleton(IExtHostExtensionService, ExtHostExtensionService);
788
856
registerSingleton(IExtHostSearch, ExtHostSearch);
789
857
+ registerSingleton(IExtHostNodeProxy, ExtHostNodeProxy);
790
858
791
- // register services that only throw errors
792
- function NotImplementedProxy<T>(name: ServiceIdentifier<T>): { new(): T } {
859
+ - // register services that only throw errors
860
+ - function NotImplementedProxy<T>(name: ServiceIdentifier<T>): { new(): T } {
861
+ - return <any>class {
862
+ - constructor() {
863
+ - return new Proxy({}, {
864
+ - get(target: any, prop: string | number) {
865
+ - if (target[prop]) {
866
+ - return target[prop];
867
+ - }
868
+ - throw new Error(`Not Implemented: ${name}->${String(prop)}`);
869
+ - }
870
+ - });
871
+ - }
872
+ - };
873
+ - }
874
+ registerSingleton(IExtHostTerminalService, WorkerExtHostTerminalService);
875
+ registerSingleton(IExtHostTask, WorkerExtHostTask);
876
+ registerSingleton(IExtHostDebugService, WorkerExtHostDebugService);
877
+ - registerSingleton(IExtensionStoragePaths, class extends NotImplementedProxy(IExtensionStoragePaths) {
878
+ - whenReady = Promise.resolve();
879
+ - });
880
+ + registerSingleton(IExtensionStoragePaths, ExtensionStoragePaths);
793
881
diff --git a/src/vs/workbench/services/localizations/electron-browser/localizationsService.ts b/src/vs/workbench/services/localizations/electron-browser/localizationsService.ts
794
882
index 99394090da..4891e0fece 100644
795
883
--- a/src/vs/workbench/services/localizations/electron-browser/localizationsService.ts
0 commit comments