|
| 1 | +Make storage local to the remote server |
| 2 | + |
| 3 | +This solves two problems: |
| 4 | + 1. Extensions running in the browser (like Vim) might use these paths |
| 5 | + directly instead of using the file service and most likely can't write |
| 6 | + to `/User` on disk. |
| 7 | + 2. Settings will be stored in the file system instead of in browser |
| 8 | + storage. Using browser storage makes sharing or seeding settings |
| 9 | + between browsers difficult. We may want to revisit this once/if we get |
| 10 | + settings sync. |
| 11 | + |
| 12 | +Unfortunately this does not affect state which uses a separate method with |
| 13 | +IndexedDB and does not appear nearly as easy to redirect to disk. |
| 14 | + |
| 15 | +To test install the Vim extension and make sure something that uses file storage |
| 16 | +works (history recall for example) and change settings from the UI and on disk |
| 17 | +while making sure they appear on the other side. |
| 18 | + |
| 19 | +Index: sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts |
| 20 | +=================================================================== |
| 21 | +--- sagemaker-code-editor.orig/vscode/src/vs/server/node/webClientServer.ts |
| 22 | ++++ sagemaker-code-editor/vscode/src/vs/server/node/webClientServer.ts |
| 23 | +@@ -332,6 +332,7 @@ export class WebClientServer { |
| 24 | + const workbenchWebConfiguration = { |
| 25 | + remoteAuthority, |
| 26 | + webviewEndpoint: vscodeBase + this._staticRoute + '/out/vs/workbench/contrib/webview/browser/pre', |
| 27 | ++ userDataPath: this._environmentService.userDataPath, |
| 28 | + _wrapWebWorkerExtHostInIframe, |
| 29 | + developmentOptions: { enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined, logLevel: this._logService.getLevel() }, |
| 30 | + settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined, |
| 31 | +Index: sagemaker-code-editor/vscode/src/vs/workbench/browser/web.api.ts |
| 32 | +=================================================================== |
| 33 | +--- sagemaker-code-editor.orig/vscode/src/vs/workbench/browser/web.api.ts |
| 34 | ++++ sagemaker-code-editor/vscode/src/vs/workbench/browser/web.api.ts |
| 35 | +@@ -276,6 +276,11 @@ export interface IWorkbenchConstructionO |
| 36 | + */ |
| 37 | + readonly configurationDefaults?: Record<string, any>; |
| 38 | + |
| 39 | ++ /** |
| 40 | ++ * Path to the user data directory. |
| 41 | ++ */ |
| 42 | ++ readonly userDataPath?: string |
| 43 | ++ |
| 44 | + //#endregion |
| 45 | + |
| 46 | + //#region Profile options |
| 47 | +Index: sagemaker-code-editor/vscode/src/vs/workbench/services/environment/browser/environmentService.ts |
| 48 | +=================================================================== |
| 49 | +--- sagemaker-code-editor.orig/vscode/src/vs/workbench/services/environment/browser/environmentService.ts |
| 50 | ++++ sagemaker-code-editor/vscode/src/vs/workbench/services/environment/browser/environmentService.ts |
| 51 | +@@ -102,7 +102,14 @@ export class BrowserWorkbenchEnvironment |
| 52 | + get logFile(): URI { return joinPath(this.windowLogsPath, 'window.log'); } |
| 53 | + |
| 54 | + @memoize |
| 55 | +- get userRoamingDataHome(): URI { return URI.file('/User').with({ scheme: Schemas.vscodeUserData }); } |
| 56 | ++ get userRoamingDataHome(): URI { return joinPath(URI.file(this.userDataPath).with({ scheme: Schemas.vscodeRemote }), 'User'); } |
| 57 | ++ |
| 58 | ++ get userDataPath(): string { |
| 59 | ++ if (!this.options.userDataPath) { |
| 60 | ++ throw new Error('userDataPath was not provided to the browser'); |
| 61 | ++ } |
| 62 | ++ return this.options.userDataPath; |
| 63 | ++ } |
| 64 | + |
| 65 | + @memoize |
| 66 | + get argvResource(): URI { return joinPath(this.userRoamingDataHome, 'argv.json'); } |
0 commit comments