Skip to content

Add support for developing with rust-analyzer#343

Merged
nspin merged 6 commits into
seL4:mainfrom
nspin:pr/vscode
Apr 28, 2026
Merged

Add support for developing with rust-analyzer#343
nspin merged 6 commits into
seL4:mainfrom
nspin:pr/vscode

Conversation

@nspin
Copy link
Copy Markdown
Member

@nspin nspin commented Apr 28, 2026

Before this PR, this project only supported developing with rust-analyzer in the ./hacking workspace, which only contains development tools. This PR adds the configuration, tools, and scripts necessary to enable leveraging rust-analyzer for development on the rest of the crates in this project.

This PR just adds support for rust-analyzer via VSCode, but the approach taken could be retargeted to other editor environments.

The challenge has always been that some of the crates in this project target the development system and require libstd, whereas others target seL4 userspace and require an active seL4 configuration. The solution in this PR is to add a script that wraps rust-analyzer, supplying it with some Cargo configuration (e.g. pointing to an active seL4 configuration) and limiting it to a subset of the crates in the project. .vscode/settings.json points VSCode to this wrapper.

When opening this project in VSCode, a default configuration is chosen, without any additional Cargo configuration, and limited to the subset of crates that can be compiled without a seL4 configuration.

The create-vscode-workspace tool can be used to generate a *.code-workspace file that, when opened in VSCode, will run rust-analyzer with the given config and crate subset. For example:

$ make cargo-config
$ cargo run \
    --manifest-path=hacking/Cargo.toml \
    -p create-vscode-workspace -- \
    --config .cargo/gen/target/aarch64-sel4-microkit.toml \
    --config .cargo/gen/world/aarch64.microkitDefault.toml \
    --include microkit-http-server-example-server \
    -o foo.code-workspace
$ code foo.code-workspace

Future PRs with stabilize, improve usability, add docs, and check in some workspace files.

nspin added 5 commits April 28, 2026 02:51
Signed-off-by: Nick Spinale <nick@nickspinale.com>
Signed-off-by: Nick Spinale <nick@nickspinale.com>
Signed-off-by: Nick Spinale <nick@nickspinale.com>
Signed-off-by: Nick Spinale <nick@nickspinale.com>
Signed-off-by: Nick Spinale <nick@nickspinale.com>
Signed-off-by: Nick Spinale <nick@nickspinale.com>
@nspin nspin merged commit de6f941 into seL4:main Apr 28, 2026
14 checks passed
@nspin nspin deleted the pr/vscode branch April 28, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant