Skip to content

Commit b52c0f9

Browse files
committed
refactor(vscode-web): migrate to VS Code CLI with code serve-web
- Replace code-server with official VS Code CLI - Download CLI from code.visualstudio.com using cli-alpine-* URLs - Add release_channel variable (stable/insiders) - Add commit_id variable to pin specific VS Code versions - Support offline mode with fallback to code-server or cached vscode-server - Add comprehensive bun tests for settings, extensions, and CLI arguments - Add Terraform tests for variable validation
1 parent 678c3e6 commit b52c0f9

File tree

5 files changed

+1255
-157
lines changed

5 files changed

+1255
-157
lines changed

registry/coder/modules/vscode-web/README.md

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ tags: [ide, vscode, web]
88

99
# VS Code Web
1010

11-
Automatically install [Visual Studio Code Server](https://code.visualstudio.com/docs/remote/vscode-server) in a workspace and create an app to access it via the dashboard.
11+
Automatically install the [VS Code CLI](https://code.visualstudio.com/docs/editor/command-line) and run `code serve-web` in a workspace to access VS Code via the browser.
1212

1313
```tf
1414
module "vscode-web" {
1515
count = data.coder_workspace.me.start_count
1616
source = "registry.coder.com/coder/vscode-web/coder"
17-
version = "1.4.3"
17+
version = "2.0.0"
1818
agent_id = coder_agent.example.id
1919
accept_license = true
2020
}
@@ -30,7 +30,7 @@ module "vscode-web" {
3030
module "vscode-web" {
3131
count = data.coder_workspace.me.start_count
3232
source = "registry.coder.com/coder/vscode-web/coder"
33-
version = "1.4.3"
33+
version = "2.0.0"
3434
agent_id = coder_agent.example.id
3535
install_prefix = "/home/coder/.vscode-web"
3636
folder = "/home/coder"
@@ -44,7 +44,7 @@ module "vscode-web" {
4444
module "vscode-web" {
4545
count = data.coder_workspace.me.start_count
4646
source = "registry.coder.com/coder/vscode-web/coder"
47-
version = "1.4.3"
47+
version = "2.0.0"
4848
agent_id = coder_agent.example.id
4949
extensions = ["github.copilot", "ms-python.python", "ms-toolsai.jupyter"]
5050
accept_license = true
@@ -59,7 +59,7 @@ Configure VS Code's [settings.json](https://code.visualstudio.com/docs/getstarte
5959
module "vscode-web" {
6060
count = data.coder_workspace.me.start_count
6161
source = "registry.coder.com/coder/vscode-web/coder"
62-
version = "1.4.3"
62+
version = "2.0.0"
6363
agent_id = coder_agent.example.id
6464
extensions = ["dracula-theme.theme-dracula"]
6565
settings = {
@@ -69,32 +69,50 @@ module "vscode-web" {
6969
}
7070
```
7171

72-
### Pin a specific VS Code Web version
72+
### Open an existing workspace on startup
7373

74-
By default, this module installs the latest. To pin a specific version, retrieve the commit ID from the [VS Code Update API](https://update.code.visualstudio.com/api/commits/stable/server-linux-x64-web) and verify its corresponding release on the [VS Code GitHub Releases](https://github.com/microsoft/vscode/releases).
74+
To open an existing workspace on startup the `workspace` parameter can be used to represent a path on disk to a `code-workspace` file.
75+
Note: Either `workspace` or `folder` can be used, but not both simultaneously. The `code-workspace` file must already be present on disk.
7576

7677
```tf
7778
module "vscode-web" {
78-
count = data.coder_workspace.me.start_count
79-
source = "registry.coder.com/coder/vscode-web/coder"
80-
version = "1.4.3"
81-
agent_id = coder_agent.example.id
82-
commit_id = "e54c774e0add60467559eb0d1e229c6452cf8447"
79+
count = data.coder_workspace.me.start_count
80+
source = "registry.coder.com/coder/vscode-web/coder"
81+
version = "2.0.0"
82+
agent_id = coder_agent.example.id
83+
workspace = "/home/coder/coder.code-workspace"
8384
accept_license = true
8485
}
8586
```
8687

87-
### Open an existing workspace on startup
88+
### Use VS Code Insiders
8889

89-
To open an existing workspace on startup the `workspace` parameter can be used to represent a path on disk to a `code-workspace` file.
90-
Note: Either `workspace` or `folder` can be used, but not both simultaneously. The `code-workspace` file must already be present on disk.
90+
Use the VS Code Insiders release channel to get the latest features and bug fixes:
9191

9292
```tf
9393
module "vscode-web" {
94-
count = data.coder_workspace.me.start_count
95-
source = "registry.coder.com/coder/vscode-web/coder"
96-
version = "1.4.3"
97-
agent_id = coder_agent.example.id
98-
workspace = "/home/coder/coder.code-workspace"
94+
count = data.coder_workspace.me.start_count
95+
source = "registry.coder.com/coder/vscode-web/coder"
96+
version = "2.0.0"
97+
agent_id = coder_agent.example.id
98+
release_channel = "insiders"
99+
accept_license = true
99100
}
100101
```
102+
103+
### Pin a specific VS Code version
104+
105+
Use the `commit_id` variable to pin a specific VS Code Server version by its commit SHA:
106+
107+
```tf
108+
module "vscode-web" {
109+
count = data.coder_workspace.me.start_count
110+
source = "registry.coder.com/coder/vscode-web/coder"
111+
version = "2.0.0"
112+
agent_id = coder_agent.example.id
113+
commit_id = "e54c774e0add60467559eb0d1e229c6452cf8447"
114+
accept_license = true
115+
}
116+
```
117+
118+
You can find the commit SHA for a specific VS Code version on the [VS Code releases page](https://code.visualstudio.com/updates) or by checking the "About" dialog in VS Code.

0 commit comments

Comments
 (0)