This page documents the day-to-day development workflow for contributors working on code-server. It covers the development iteration cycle using watch mode, managing VS Code patches with quilt, code formatting, and linting tools.
The primary development workflow uses npm run watch to enable rapid iteration. This script launches a watcher process that orchestrates multiple compilers and a development web server.
The watch mode is implemented in ci/dev/watch.ts. It manages several child processes simultaneously to handle different parts of the stack.
Watcher Orchestration Diagram
Implementation Details:
Watcher class initializes compilers for code-server (using tsc), VS Code (using internal npm scripts), and optional plugins ci/dev/watch.ts46-53tsc outputs "Watching for file changes" or VS Code outputs "Finished compilation", the watcher triggers a server reload via reloadWebServer ci/dev/watch.ts90-93 ci/dev/watch.ts101-104out/node/entry.js and inherits CLI arguments passed to the watch script ci/dev/watch.ts31-33Sources: ci/dev/watch.ts13-40 ci/dev/watch.ts46-53 ci/dev/watch.ts85-105
The build and watch processes rely on tsconfig.json settings.
| Setting | Value | Purpose |
|---|---|---|
outDir | ./out | Destination for compiled JavaScript tsconfig.json11 |
incremental | true | Enables faster subsequent builds via .cache/tsbuildinfo tsconfig.json17-18 |
target | es6 | Target ECMAScript version tsconfig.json3 |
module | commonjs | Module system used by the Node.js backend tsconfig.json5 |
Sources: tsconfig.json1-30
Code-server modifies the VS Code source code (located in lib/vscode) using quilt. This allows maintaining a clean separation between upstream VS Code and code-server's specific changes.
Quilt Operations Diagram
Key Concepts:
patches/series, this file defines the order in which patches are applied.lib/vscode, developers must run quilt refresh to update the patch files in the patches/ directory.The ci/build/update-vscode.sh script automates the maintenance of patches when the upstream VS Code version changes. It includes functions for:
unapply_patches: Uses quilt pop -af to revert the VS Code submodule to a clean state ci/build/update-vscode.sh5-16apply_patches: Uses quilt push -a to apply all patches in the series ci/build/update-vscode.sh18-29refresh_patches: Iteratively pushes and refreshes patches to resolve conflicts during updates ci/build/update-vscode.sh42-53update_csp: Regenerates Content Security Policy hashes for webviews and worker extension hosts, storing them in patches/csp-hashes.diff ci/build/update-vscode.sh85-107 patches/csp-hashes.diff1-26Sources: ci/build/update-vscode.sh5-107 patches/csp-hashes.diff1-26
The project enforces strict code quality standards through automated tools.
Prettier is used to ensure consistent code style. The configuration is defined in .prettierrc.yaml.
printWidth of 120, no semicolons (semi: false), and double quotes .prettierrc.yaml1-7lib (VS Code source), release, and .pc (quilt state) .prettierignore1-8The ci/dev/doctoc.sh script is used to maintain Tables of Contents in Markdown files like docs/CONTRIBUTING.md and docs/CODE_OF_CONDUCT.md ci/dev/doctoc.sh7-15
The ci/build/build-code-server.sh script handles the final steps of the build, including:
tsc to compile the source ci/build/build-code-server.sh9out/node/entry.js and making it executable ci/build/build-code-server.sh13-16Sources: .prettierrc.yaml1-6 .prettierignore1-8 ci/dev/doctoc.sh7-15 ci/build/build-code-server.sh9-16
The standard iteration cycle for a developer follows this sequence:
quilt push -a.npm run watch to start the compilers and dev server.src/. tsc --watch will recompile to out/ ci/dev/watch.ts47lib/vscode/. The VS Code watch task will recompile ci/dev/watch.ts48reloadWebServer() ci/dev/watch.ts92quilt refresh if lib/vscode was modified, and ensure formatting complies with .prettierrc.yaml.Sources: ci/dev/watch.ts26-40 ci/dev/watch.ts85-105 .prettierrc.yaml1-6
Refresh this wiki