To get language support in VSCode and other IDEs we recommend using clangd-based language server.
The server reads supplied compile_flags.txt file for correct options and include paths to resolve symbols
in opened files.
To support clangd project-level operations like Find References compile_commands.json file needs to
be generated that will list all files in the project. If you do this, then it needs to be re-generated periodically
when new files appear.
- Install
gen-compile-commands
just prepare- Generate
compile_commands.json
just compile-commandsIn order to install dependencies, please run the following command. Also refer to Building workerd in README.md for the list of required dependencies by platform.
- For Ubuntu:
just prepare-ubuntuCloudflare employees can build and test on bazelflare, which runs every action on Linux x86_64
executors and shares its cache with CI. Log in once with
cloudflared access login https://bazelflare-workerd.runtime-playground.workers.dev, then add
--config=bazelflare (or bazelflare-asan, bazelflare-tsan) to a bazel build or bazel test
command, from macOS or Linux. Tests that need the network or a container engine are skipped; see
the bazelflare section of .bazelrc.
just format formats the repository using clang-format, prettier, ruff, buildifier, and rustfmt.
tools/cross/format.json defines which formatter applies to which files.
just format # everything
just format path/to/file ... # specific files
just format-head # files changed since HEAD~The formatters are built by Bazel at pinned versions, so nothing needs to be installed beyond what
just prepare sets up. To check without modifying files, run python3 tools/cross/format.py --check.
To enable the pre-commit hook, run:
git config core.hooksPath githooksThe hook rejects commits that add KJ_DBG and checks formatting of staged files. Skip it with
git commit --no-verify.
CI checks formatting with format.py --check, runs clippy and rustfmt via --config=lint, and runs
ESLint as <target>@eslint test targets.
just lint: ESLintjust clippy [package]: Rust clippy; see src/rust/AGENTS.mdjust clang-tidy [target]: clang-tidy with workerd's custom checks; see build/AGENTS.md