Skip to content

Add Rust support with rustaceanvim - #16

Merged
SimonKimDev merged 1 commit into
mainfrom
simonk/dev/rust
Oct 18, 2026
Merged

SimonKimDev merged 1 commit into
mainfrom
simonk/dev/rust

Conversation

@SimonKimDev

Copy link
Copy Markdown
Owner

Adds Rust support, built on the 0.12 upgrade in #15.

  • lazy/rust.lua: rustaceanvim v9 (needs Neovim 0.12). It runs rust-analyzer from the toolchain on PATH, not Mason's, so it matches the compiler; clippy is its default checker.
  • Debugging: mason-nvim-dap installs codelldb, which rustaceanvim finds on its own. Its mason-nvim-dap handler is a no-op so rustaceanvim owns the Rust adapter and configurations.
  • Tests: rustaceanvim.neotest added to neotest (<leader>T… maps work for Rust).
  • Treesitter: rust and toml parsers. dap-virtual-text also covers Rust.
  • after/ftplugin/rust.lua: <leader>b (:make!) runs cargo build into quickfix; <leader>rr runnables, <leader>rd debuggables, <leader>re explain error. All three were unused.
  • Smoke test: Rust buffers get treesitter highlighting and the trim formatter after rust-analyzer's rustfmt; fails if rust_analyzer is also enabled through lspconfig (two clients would duplicate every result).
  • README requirement: rustup component add rust-analyzer (with msrustup: msrustup component add rust-analyzer).

Tested locally on 0.12.6 with a throwaway cargo new project:

  • rust-analyzer attached (no duplicate lspconfig client), references supported, treesitter highlighting on
  • rust-analyzer listed the test runnables (test tests::adds, cargo test …)
  • a real debug session through codelldb stopped at a breakpoint in main
  • fresh smoke run passes

- rustaceanvim v9 runs the toolchain's rust-analyzer (not Mason's) with
  clippy as the checker, and finds Mason's codelldb for debugging.
  mason-nvim-dap installs codelldb but leaves its setup to rustaceanvim.
- rust and toml treesitter parsers; neotest gets rustaceanvim's adapter;
  dap-virtual-text covers Rust.
- after/ftplugin/rust.lua: :make runs cargo build into quickfix, and
  <leader>rr / <leader>rd / <leader>re open runnables, debuggables and
  the error explanation.
- Smoke test checks Rust buffers get treesitter highlighting and that
  rust_analyzer isn't also enabled through lspconfig.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 90315f97-7c82-4bc1-9bf1-2f8460782554
@SimonKimDev
SimonKimDev marked this pull request as ready for review October 18, 2026 01:06
@SimonKimDev
SimonKimDev merged commit fb309b3 into main Oct 18, 2026
2 checks passed
@SimonKimDev
SimonKimDev deleted the simonk/dev/rust branch October 18, 2026 01:06
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