Skip to content

feat(nvim): Rust and TypeScript development support - #201

Merged
aguil merged 10 commits into
masterfrom
feat/nvim-rust-typescript
Nov 29, 2026
Merged

aguil merged 10 commits into
masterfrom
feat/nvim-rust-typescript

Conversation

@aguil

@aguil aguil commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Why the change

Neovim had no Rust tooling and only partial TypeScript tooling, so this adds language servers, debugging, tests, linting and schemas for both, without slowing startup.

Special things to note

  • Rust needs rustup component add rust-analyzer rust-src, and delve is left out of the debug installs because it needs a newer Go than is installed.
  • ESLint moves from eslint_d (through nvim-lint) to the ESLint language server, so JS/TS diagnostics now come from a different source.
  • Two small workarounds avoid slow PATH searches on WSL: a package.preload hook for rustaceanvim's nextest check, and a file check for mason's tree-sitter.

Change outline

Most of the new Rust setup lives in its own plugin file. TypeScript changes extend the existing files.

 dot_config/nvim/
 ├── init.lua                      # servers, mason installs, parsers, neotest, conform
+│                                 #   + eslint, biome, taplo, SchemaStore, rust parser,
+│                                 #   + jest/rust adapters, debug module enabled
 ├── lazy-lock.json
 └── lua/
     ├── custom/plugins/
+    │   ├── rust.lua              # rustaceanvim, crates.nvim, rustfmt, nextest probe hook
     │   └── typescript.lua        # eslint_d removed, Biome-or-Prettier choice, <leader>cE
     └── kickstart/plugins/
         └── debug.lua             # codelldb + js-debug (pwa-node, pwa-chrome) configs

Each JS/TS buffer now picks its formatter from the project:

 on save (javascript, typescript, jsx, tsx)
-  run prettierd, else prettier
+  if biome.json or biome.jsonc is above the file
+    run biome
+  else
+    run prettierd, else prettier

Which tools serve each buffer:

 .rs          rustaceanvim -> rust-analyzer (clippy on save), rustfmt, codelldb, neotest
 Cargo.toml   crates.nvim (in-process LSP) + taplo
 .ts / .js    typescript-tools
-             + eslint_d (diagnostics only)
+             + eslint LSP (diagnostics + fixes), biome LSP in Biome projects
+             + js-debug, neotest (vitest, jest)
 .json/.yaml  jsonls / yamlls
+             + SchemaStore catalog, loaded on first server start

First Rust buffer, before and after the nextest hook:

 require('rustaceanvim.config.internal')
   build defaults
     enable_nextest = vim.fn.executable('cargo-nextest')
-      walk all 79 PATH entries, 42 under /mnt/c       ~80-120 ms
+      stat $CARGO_HOME/bin/cargo-nextest              ~0.01 ms
   merge vim.g.rustaceanvim

Details

Summary

Close the gaps that kept Neovim from being usable on a Rust + TypeScript
stack. Rust had no language server, parser, formatter, debugger, or test
adapter. TypeScript worked, but had no debugger, no ESLint fixes, no Jest
adapter, no JSON schemas, and no Biome support.

Changes

Commit What it adds
feat(nvim): add Rust support via rustaceanvim rust-analyzer (from rustup) with clippy on save, <leader>r… maps for runnables, testables, debuggables, macro expansion and error explanations, the rust parser, rustfmt
feat(nvim): add Cargo.toml support with crates.nvim and taplo Crate version/feature completion and TOML LSP; toml is excluded from format-on-save
feat(nvim): enable DAP for Rust and TypeScript Turns on the kickstart debug module: codelldb for Rust, js-debug (pwa-node, pwa-chrome) with launch, tsx, and attach configs
feat(nvim): add Rust and Jest neotest adapters rustaceanvim and Jest adapters next to vitest, plus nearest/last/debug/summary/stop maps
feat(nvim): use the ESLint language server for JS/TS Replaces lint-only eslint_d; fixes become code actions, <leader>cE fixes all
feat(nvim): add SchemaStore schemas to jsonls and yamlls Validation and completion for package.json, tsconfig.json, workflows; loads only when a JSON/YAML server starts
feat(nvim): format and lint with Biome in Biome projects Biome formatter and LSP only where a biome.json[c] exists
chore(nvim): stop installing typescript-language-server Drops an unused mason package
perf(nvim): skip rustaceanvim's PATH probe for cargo-nextest Saves ~120 ms on the first Rust buffer under WSL
perf(nvim): stat mason's tree-sitter instead of searching PATH Removes a 65–125 ms PATH walk that hit about half of all startups (pre-existing)

Testing

All checks ran headlessly against this source tree with isolated XDG dirs.
Nothing was applied to the live config.

  • rust-analyzer attached to a test Cargo project with clippy configured; Rust highlighting, <leader>r maps and rustfmt active.
  • crates.nvim and taplo attached on Cargo.toml.
  • A JS breakpoint stopped on the right line through js-debug; rustaceanvim resolved codelldb from mason.
  • A cargo test ran and passed through neotest.
  • ESLint reported prefer-const, and LspEslintFixAll rewrote let to const.
  • jsonls flagged a wrong type in package.json using SchemaStore schemas.
  • Biome formatted on save and its LSP attached in a Biome project; Prettier stayed in effect elsewhere.
  • pre-commit (stylua) passes.

Startup, randomized A/B against master (medians, middle half in brackets):

Scenario master this branch
No file 105 ms (75–185) 76 ms (72–82)
.rs file 101 ms (88–191) 169 ms (163–181)
.ts file 320 ms (289–393) 288 ms (280–301)
.json file 96 ms (86–195) 100 ms (96–104)

The Rust increase is almost all vim.treesitter.start loading the Rust
grammar for the first time; master had no Rust parser.

Notes

  • Needs rustup component add rust-analyzer rust-src (already done on this machine).
  • delve is left out of ensure_installed: current delve needs Go ≥ 1.25 and 1.23.1 is installed.
  • Not included: a Tailwind language server and monorepo root tuning for typescript-tools.

🤖 Generated with Claude Code

aguil and others added 10 commits November 29, 2026 11:28
rustaceanvim owns rust-analyzer (from rustup) with clippy as the on-save
check, buffer-local <leader>r maps for runnables, testables, debuggables
and macro expansion, the rust treesitter parser, and rustfmt via conform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
crates.nvim runs as an in-process language server on Cargo.toml for
version and feature completion, hover and code actions. taplo covers all
TOML buffers; toml is excluded from format-on-save so hand-edited files
only reformat on <leader>f.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Turn on kickstart's debug module. mason-nvim-dap installs codelldb, which
rustaceanvim picks up for :RustLsp debuggables, and js-debug-adapter,
wired as pwa-node/pwa-chrome with launch, tsx, and attach configurations
for JS/TS buffers. delve stays out of ensure_installed because it needs
a newer Go than is installed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rustaceanvim's adapter covers cargo tests and neotest-jest covers Jest
projects next to vitest. New maps run the nearest test, rerun the last,
debug the nearest via DAP, toggle the summary, and stop a run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eslint_d only produced diagnostics through nvim-lint. The eslint server
runs the project's own eslint and also offers its fixes as code actions,
with <leader>cE for LspEslintFixAll. nvim-lint keeps the prose linters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
package.json, tsconfig.json, GitHub workflow and other config files now
get completion and validation. The catalog is required from before_init,
so it only loads when a JSON or YAML server starts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a biome.json[c] sits above the buffer, conform formats JS/TS with
biome instead of prettier, and the biome language server attaches for
diagnostics. Projects without a Biome config are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
typescript-tools talks to tsserver directly and ts_ls is never enabled,
so the mason package was an unused install.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rustaceanvim checks vim.fn.executable('cargo-nextest') while building its
defaults, before user config is merged. When nextest is absent on WSL
that walks every /mnt/c PATH entry, adding about 120 ms to the first
Rust buffer. A package.preload hook answers that one lookup with a stat
of $CARGO_HOME/bin for the duration of the module load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The parser-install guard called vim.fn.executable('tree-sitter') on every
startup. Mason's bin dir is often not on PATH yet at that point, so on
WSL the search walked the /mnt/c entries before reaching a mise shim,
adding 65-125 ms to roughly half of all startups. Check mason's copy
with fs_stat first and search PATH only when it is missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aguil
aguil marked this pull request as ready for review November 29, 2026 18:40
@aguil
aguil merged commit 4e63077 into master Nov 29, 2026
1 check passed
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