2020-06-03 19:07:42 +03:00
|
|
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
|
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
2020-02-19 03:07:01 +03:00
|
|
|
# Contributing
|
|
|
|
|
2020-06-03 19:07:42 +03:00
|
|
|
- [Requirements](#requirements)
|
|
|
|
- [Development Workflow](#development-workflow)
|
|
|
|
- [Build](#build)
|
|
|
|
- [Structure](#structure)
|
|
|
|
- [VS Code Patch](#vs-code-patch)
|
|
|
|
|
|
|
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
|
|
|
2020-04-30 14:52:54 +03:00
|
|
|
- [Detailed CI and build process docs](../ci)
|
|
|
|
|
2020-05-13 06:11:31 +03:00
|
|
|
## Requirements
|
|
|
|
|
|
|
|
Please refer to [VS Code's prerequisites](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites).
|
|
|
|
|
|
|
|
Differences:
|
2020-02-19 03:07:01 +03:00
|
|
|
|
2020-05-17 23:53:08 +03:00
|
|
|
- We require a minimum of node v12 but later versions should work.
|
|
|
|
- We use [fnpm](https://github.com/goreleaser/nfpm) to build `.deb` and `.rpm` packages.
|
2020-05-21 19:57:29 +03:00
|
|
|
- We use [jq](https://stedolan.github.io/jq/) to build code-server releases.
|
2020-06-03 19:14:55 +03:00
|
|
|
- The [CI container](../ci/images/debian8/Dockerfile) is a useful reference for all our dependencies.
|
2020-05-13 06:11:31 +03:00
|
|
|
|
|
|
|
## Development Workflow
|
2020-02-19 03:07:01 +03:00
|
|
|
|
|
|
|
```shell
|
|
|
|
yarn
|
|
|
|
yarn vscode
|
2020-05-17 23:53:08 +03:00
|
|
|
yarn watch
|
|
|
|
# Visit http://localhost:8080 once the build completed.
|
2020-02-19 03:07:01 +03:00
|
|
|
```
|
|
|
|
|
2020-04-15 01:22:52 +03:00
|
|
|
To develop inside of an isolated docker container:
|
|
|
|
|
|
|
|
```shell
|
2020-06-03 19:09:01 +03:00
|
|
|
./ci/dev/image/exec.sh
|
2020-04-15 01:22:52 +03:00
|
|
|
|
|
|
|
root@12345:/code-server# yarn
|
|
|
|
root@12345:/code-server# yarn vscode
|
|
|
|
root@12345:/code-server# yarn watch
|
|
|
|
```
|
|
|
|
|
2020-02-19 03:07:01 +03:00
|
|
|
Any changes made to the source will be live reloaded.
|
|
|
|
|
|
|
|
If changes are made to the patch and you've built previously you must manually
|
|
|
|
reset VS Code then run `yarn vscode:patch`.
|
|
|
|
|
|
|
|
## Build
|
|
|
|
|
|
|
|
```shell
|
|
|
|
yarn
|
2020-02-26 23:48:08 +03:00
|
|
|
yarn vscode
|
2020-02-19 03:07:01 +03:00
|
|
|
yarn build
|
2020-04-30 14:52:54 +03:00
|
|
|
yarn build:vscode
|
|
|
|
yarn release
|
2020-05-08 23:31:42 +03:00
|
|
|
cd release
|
|
|
|
yarn --production
|
2020-05-17 23:53:08 +03:00
|
|
|
# Runs the built JavaScript with Node.
|
|
|
|
node .
|
2020-02-19 03:07:01 +03:00
|
|
|
```
|
2020-05-13 06:11:31 +03:00
|
|
|
|
2020-05-27 23:48:11 +03:00
|
|
|
Now you can build release packages with:
|
2020-05-13 06:11:31 +03:00
|
|
|
|
|
|
|
```
|
2020-05-27 23:39:17 +03:00
|
|
|
yarn release:standalone
|
2020-05-27 23:48:11 +03:00
|
|
|
# The standalone release is in ./release-standalone
|
2020-05-27 23:39:17 +03:00
|
|
|
yarn test:standalone-release
|
2020-05-13 06:11:31 +03:00
|
|
|
yarn package
|
2020-05-27 23:39:17 +03:00
|
|
|
# .deb, .rpm and the standalone archive are in ./release-packages
|
2020-05-13 06:11:31 +03:00
|
|
|
```
|
|
|
|
|
2020-05-17 23:53:08 +03:00
|
|
|
## Structure
|
|
|
|
|
|
|
|
The `code-server` script serves an HTTP API to login and start a remote VS Code process.
|
|
|
|
|
|
|
|
The CLI code is in [./src/node](./src/node) and the HTTP routes are implemented in
|
|
|
|
[./src/node/app](./src/node/app).
|
|
|
|
|
|
|
|
Most of the meaty parts are in our VS Code patch which is described next.
|
|
|
|
|
|
|
|
### VS Code Patch
|
|
|
|
|
|
|
|
Back in v1 of code-server, we had an extensive patch of VS Code that split the codebase
|
|
|
|
into a frontend and server. The frontend consisted of all UI code and the server ran
|
|
|
|
the extensions and exposed an API to the frontend for file access and everything else
|
|
|
|
that the UI needed.
|
|
|
|
|
|
|
|
This worked but eventually Microsoft added support to VS Code to run it in the web.
|
|
|
|
They have open sourced the frontend but have kept the server closed source.
|
|
|
|
|
|
|
|
So in interest of piggy backing off their work, v2 and beyond use the VS Code
|
|
|
|
web frontend and fill in the server. This is contained in our
|
|
|
|
[./ci/dev/vscode.patch](../ci/dev/vscode.patch) under the path `src/vs/server`.
|
|
|
|
|
|
|
|
Other notable changes in our patch include:
|
|
|
|
|
|
|
|
- Add our own build file which includes our code and VS Code's web code.
|
|
|
|
- Allow multiple extension directories (both user and built-in).
|
|
|
|
- Modify the loader, websocket, webview, service worker, and asset requests to
|
|
|
|
use the URL of the page as a base (and TLS if necessary for the websocket).
|
|
|
|
- Send client-side telemetry through the server.
|
|
|
|
- Allow modification of the display language.
|
|
|
|
- Make it possible for us to load code on the client.
|
|
|
|
- Make extensions work in the browser.
|
|
|
|
- Make it possible to install extensions of any kind.
|
|
|
|
- Fix getting permanently disconnected when you sleep or hibernate for a while.
|
|
|
|
- Add connection type to web socket query parameters.
|
|
|
|
|
|
|
|
Some known issues presently:
|
|
|
|
|
|
|
|
- Creating custom VS Code extensions and debugging them doesn't work.
|
|
|
|
- Extension profiling and tips are currently disabled.
|
|
|
|
|
|
|
|
As the web portion of VS Code matures, we'll be able to shrink and maybe even entirely
|
|
|
|
eliminate our patch. In the meantime, however, upgrading the VS Code version requires
|
|
|
|
ensuring that the patch still applies and has the intended effects.
|
|
|
|
|
|
|
|
To generate a new patch run `yarn vscode:diff`.
|
|
|
|
|
|
|
|
**note**: We have extension docs on the CI and build system at [./ci/README.md](../ci/README.md)
|
|
|
|
|
|
|
|
If functionality doesn't depend on code from VS Code then it should be moved
|
|
|
|
into code-server otherwise it should be in the patch.
|
|
|
|
|
|
|
|
In the future we'd like to run VS Code unit tests against our builds to ensure features
|
|
|
|
work as expected.
|