You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Switch submodule to track upstream
- Add quilt to the process
- Add patches
The node-* ignore was ignoring one of the diffs so I removed it. This
was added when we were curling Node as node-v{version}-darwin-x64 for
the macOS build but this no longer happens (we use the Node action to
install a specific version now so we just use the system-wide Node).
These are required by VS Code. See [their Wiki](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites) for more information.
63
+
These are required by Code. See [their Wiki](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites) for more information.
61
64
62
65
## Creating pull requests
63
66
@@ -78,26 +81,44 @@ we'll guide you.
78
81
79
82
## Development workflow
80
83
81
-
The current development workflow is a bit tricky because we have this repo and we use our `coder/vscode` fork inside it with [`yarn link`](https://classic.yarnpkg.com/lang/en/docs/cli/link/).
82
-
83
-
Here are these steps you should follow to get your dev environment setup:
4.`yarn watch` - This will spin up code-server on localhost:8080 which you can start developing. It will live reload changes to the source.
87
+
4.`quilt patch -a` - Apply patches to the `vscode` submodule.
88
+
5.`yarn watch` - Launch code-server localhost:8080. code-server will be live
89
+
reloaded when changes are made; the browser needs to be refreshed manually.
89
90
90
-
### Updates to VS Code
91
+
When pulling down changes that include modifications to the patches you will
92
+
need to apply them with `quilt`. If you pull down changes that update the
93
+
`vscode` submodule you will need to run `git submodule update --init` and
94
+
re-apply the patches.
91
95
92
-
If changes are made and merged into `main` in the [`coder/vscode`](https://github.com/coder/vscode) repo, then you'll need to update the version in the `code-server` repo by following these steps:
96
+
### Version updates to Code
93
97
94
-
1. Update the `lib/vscode` submodule to the latest `main`.
98
+
1. Update the `lib/vscode` submodule to the desired upstream version branch.
95
99
2. From the code-server **project root**, run `yarn install`.
96
-
3. Test code-server locally to make sure everything works.
97
-
4. Check the Node.js version that's used by Electron (which is shipped with VS
100
+
3. Apply the patches (`quilt push -a`) or restore your stashed changes. At this
101
+
stage you may need to resolve conflicts. For example use `quilt push -f`,
102
+
manually apply the rejected portions, then `quilt refresh`.
103
+
4. Test code-server locally to make sure everything works.
104
+
5. Check the Node.js version that's used by Electron (which is shipped with VS
98
105
Code. If necessary, update your version of Node.js to match.
99
-
5. Commit the updated submodule to `code-server`.
100
-
6. Open a PR.
106
+
6. Commit the updated submodule and patches to `code-server`.
107
+
7. Open a PR.
108
+
109
+
### Patching Code
110
+
111
+
0. You can go through the patch stack with `quilt push` and `quilt pop`.
112
+
1. Create a new patch (`quilt new {name}.diff`) or use an existing patch.
113
+
2. Add the file(s) you are patching (`quilt add [-P patch] {file}`). A file
114
+
**must** be added before you make changes to it.
115
+
3. Make your changes. Patches do not need to be independent of each other but
116
+
each patch must result in a working code-server without any broken in-between
117
+
states otherwise they are difficult to test and modify.
118
+
4. Add your changes to the patch (`quilt refresh`)
119
+
5. Add a comment in the patch about the reason for the patch and how to
120
+
reproduce the behavior it fixes or adds. Every patch should have an e2e test
121
+
as well.
101
122
102
123
### Build
103
124
@@ -193,99 +214,46 @@ code-server running locally. In CI, this is taken care of for you.
193
214
194
215
## Structure
195
216
196
-
The `code-server` script serves as an HTTP API for login and starting a remote VS
217
+
The `code-server` script serves as an HTTP API for login and starting a remote
197
218
Code process.
198
219
199
220
The CLI code is in [src/node](../src/node) and the HTTP routes are implemented
200
221
in [src/node/routes](../src/node/routes).
201
222
202
-
Most of the meaty parts are in the VS Code portion of the codebase under
223
+
Most of the meaty parts are in the Code portion of the codebase under
203
224
[lib/vscode](../lib/vscode), which we describe next.
204
225
205
-
### Modifications to VS Code
206
-
207
-
In v1 of code-server, we had a patch of VS Code that split the codebase into a
208
-
front-end and a server. The front-end consisted of the UI code, while the server
209
-
ran the extensions and exposed an API to the front-end for file access and all
210
-
UI needs.
211
-
212
-
Over time, Microsoft added support to VS Code to run it on the web. They have
213
-
made the front-end open source, but not the server. As such, code-server v2 (and
214
-
later) uses the VS Code front-end and implements the server. We do this by using
215
-
a Git subtree to fork and modify VS Code. This code lives under
216
-
[lib/vscode](../lib/vscode).
217
-
218
-
Some noteworthy changes in our version of VS Code include:
219
-
220
-
- Adding our build file, [`lib/vscode/coder.js`](../lib/vscode/coder.js), which includes build steps specific to code-server
221
-
- Node.js version detection changes in [`build/lib/node.ts`](../lib/vscode/build/lib/node.ts) and [`build/lib/util.ts`](../lib/vscode/build/lib/util.ts)
222
-
- Allowing extra extension directories
223
-
- Added extra arguments to [`src/vs/platform/environment/common/argv.ts`](../lib/vscode/src/vs/platform/environment/common/argv.ts) and to [`src/vs/platform/environment/node/argv.ts`](../lib/vscode/src/vs/platform/environment/node/argv.ts)
224
-
- Added extra environment state to [`src/vs/platform/environment/common/environment.ts`](../lib/vscode/src/vs/platform/environment/common/environment.ts);
225
-
- Added extra getters to [`src/vs/platform/environment/common/environmentService.ts`](../lib/vscode/src/vs/platform/environment/common/environmentService.ts)
226
-
- Added extra scanning paths to [`src/vs/platform/extensionManagement/node/extensionsScanner.ts`](../lib/vscode/src/vs/platform/extensionManagement/node/extensionsScanner.ts)
227
-
- Additions/removals from [`package.json`](../lib/vscode/package.json):
228
-
- Removing `electron`, `keytar` and `native-keymap` to avoid pulling in desktop dependencies during build on Linux
229
-
- Removing `gulp-azure-storage` and `gulp-tar` (unsued in our build process, may pull in outdated dependencies)
230
-
- Adding `proxy-agent`, `proxy-from-env` (for proxying) and `rimraf` (used during build/install steps)
- Removing azure/macOS signing related dependencies from [`build/package.json`](../lib/vscode/build/package.json)
238
-
- Modifying `.gitignore` to allow us to add files to `src/vs/server` and modifying `.eslintignore` to ignore lint on the shared files below (we use different formatter settings than VS Code).
239
-
- Sharing some files with our codebase via symlinks:
240
-
-[`src/vs/base/common/ipc.d.ts`](../lib/vscode/src/vs/base/common/ipc.d.ts) points to [`typings/ipc.d.ts`](../typings/ipc.d.ts)
241
-
-[`src/vs/base/common/util.ts`](../lib/vscode/src/vs/base/common/util.ts) points to [`src/common/util.ts`](../src/common/util.ts)
242
-
-[`src/vs/base/node/proxy_agent.ts`](../lib/vscode/src/vs/base/node/proxy_agent.ts) points to [`src/node/proxy_agent.ts`](../src/node/proxy_agent.ts)
243
-
- Allowing socket changes by adding `setSocket` in [`src/vs/base/parts/ipc/common/ipc.net.ts`](../lib/vscode/src/vs/base/parts/ipc/common/ipc.net.ts)
244
-
- We use this for connection persistence in our server-side code.
245
-
- Added our server-side Node.JS code to `src/vs/server`.
246
-
- This code includes the logic to spawn the various services (extension host, terminal, etc.) and some glue
247
-
- Added [`src/vs/workbench/browser/client.ts`](../lib/vscode/src/vs/workbench/browser/client.ts) to hold some server customizations.
248
-
- Includes the functionality for the Log Out command and menu item
249
-
- Also, imported and called `initialize` from the main web file, [`src/vs/workbench/browser/web.main.ts`](../lib/vscode/src/vs/workbench/browser/web.main.ts)
250
-
- Added a (hopefully temporary) hotfix to [`src/vs/workbench/common/resources.ts`](../lib/vscode/src/vs/workbench/common/resources.ts) to get context menu actions working for the Git integration.
251
-
- Added connection type to WebSocket query parameters in [`src/vs/platform/remote/common/remoteAgentConnection.ts`](../lib/vscode/src/vs/platform/remote/common/remoteAgentConnection.ts)
252
-
- Added `CODE_SERVER*` variables to the sanitization list in [`src/vs/base/common/processes.ts`](../lib/vscode/src/vs/base/common/processes.ts)
- Added code to allow server to inject settings to [`src/vs/platform/product/common/product.ts`](../lib/vscode/src/vs/platform/product/common/product.ts)
258
-
- Extension fixes:
259
-
- Avoid disabling extensions by extensionKind in [`src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.ts`](../lib/vscode/src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.ts) (Needed for vscode-icons)
260
-
- Remove broken symlinks in [`extensions/postinstall.js`](../lib/vscode/extensions/postinstall.js)
261
-
- Add tip about extension gallery in [`src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts`](../lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts)
262
-
- Use our own server for GitHub authentication in [`extensions/github-authentication/src/githubServer.ts`](../lib/vscode/extensions/github-authentication/src/githubServer.ts)
263
-
- Settings persistence on the server in [`src/vs/workbench/services/environment/browser/environmentService.ts`](../lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts)
264
-
- Add extension install fallback in [`src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts`](../lib/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts)
265
-
- Add proxy-agent monkeypatch and keep extension host indefinitely running in [`src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts`](../lib/vscode/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts)
266
-
- Patch build system to avoid removing extension dependencies for `yarn global add` users in [`build/lib/extensions.ts`](../lib/vscode/build/lib/extensions.ts)
267
-
- Allow all extensions to use proposed APIs in [`src/vs/workbench/services/environment/browser/environmentService.ts`](../lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts)
268
-
- Make storage writes async to allow extensions to wait for them to complete in [`src/vs/platform/storage/common/storage.ts`](../lib/vscode/src/vs/platform/storage/common/storage.ts)
269
-
- Specify webview path in [`src/vs/code/browser/workbench/workbench.ts`](../lib/vscode/src/vs/code/browser/workbench/workbench.ts)
270
-
- URL readability improvements for folder/workspace in [`src/vs/code/browser/workbench/workbench.ts`](../lib/vscode/src/vs/code/browser/workbench/workbench.ts)
0 commit comments