From 3b39482420755985f713eea4af090d6885f53c19 Mon Sep 17 00:00:00 2001 From: Asher Date: Tue, 7 Apr 2020 17:49:50 -0500 Subject: [PATCH] Document workspace and folder behavior Also fixed a type issue. --- ci/vscode.patch | 8 ++++---- doc/FAQ.md | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ci/vscode.patch b/ci/vscode.patch index 96579193..9393be35 100644 --- a/ci/vscode.patch +++ b/ci/vscode.patch @@ -261,7 +261,7 @@ index 2c64061da7..c0ef8faedd 100644 // Do nothing. If we can't read the file we have no // language pack config. diff --git a/src/vs/code/browser/workbench/workbench.ts b/src/vs/code/browser/workbench/workbench.ts -index 45f6f17ce0..102289c147 100644 +index 45f6f17ce0..546b4c24de 100644 --- a/src/vs/code/browser/workbench/workbench.ts +++ b/src/vs/code/browser/workbench/workbench.ts @@ -16,6 +16,7 @@ import product from 'vs/platform/product/common/product'; @@ -306,14 +306,14 @@ index 45f6f17ce0..102289c147 100644 const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents, workspaceUri?: UriComponents } = JSON.parse(configElementAttribute); + // Strip the protocol from the authority if it exists. -+ const normalizeAuthority = (authority?: string): string => authority && authority.replace(/^https?:\/\//, ""); ++ const normalizeAuthority = (authority: string): string => authority.replace(/^https?:\/\//, ""); + if (config.remoteAuthority) { + (config as any).remoteAuthority = normalizeAuthority(config.remoteAuthority); + } -+ if (config.workspaceUri) { ++ if (config.workspaceUri && config.workspaceUri.authority) { + config.workspaceUri.authority = normalizeAuthority(config.workspaceUri.authority); + } -+ if (config.folderUri) { ++ if (config.folderUri && config.folderUri.authority) { + config.folderUri.authority = normalizeAuthority(config.folderUri.authority); + } + diff --git a/doc/FAQ.md b/doc/FAQ.md index 8607d7e0..b9051e1a 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -104,6 +104,15 @@ demand and will work on it when the time is right. Use the `--disable-telemetry` flag to completely disable telemetry. We use the data collected only to improve code-server. +## How does code-server decide what workspace or folder to open? + +code-server tries the following in order: + +1. The `workspace` query parameter. +2. The `folder` query parameter. +3. The directory passed on the command line. +4. The last opened workspace or folder. + ## Enterprise Visit [our enterprise page](https://coder.com) for more information about our