Rust Extra
lang.rust adds Rust and TOML editor support. It assumes the Rust toolchain is
managed outside Blak with rustup or your system package manager.
Enable it
Section titled “Enable it”-- ~/.config/blak/lua/blak/user.luareturn { extras = { enabled = { "lang.rust", }, },}Or toggle it from Neovim:
:BlakExtras enable lang.rustRun :BlakExtras sync after enabling because this extra adds a plugin.
What it adds
Section titled “What it adds”| Surface | Contribution |
|---|---|
| Treesitter | rust, toml |
| Mason | codelldb |
| LSP | rust_analyzer, taplo |
| Formatting | rustfmt with LSP fallback for rust; taplo with LSP fallback for toml |
| Plugins | saecki/crates.nvim for Cargo.toml |
The extra configures rust-analyzer with cargo.allFeatures = true and
check.command = "clippy".
Configure rust-analyzer
Section titled “Configure rust-analyzer”Add non-conflicting rust-analyzer settings in user.lua:
return { extras = { enabled = { "lang.rust" }, }, lsp = { servers = { rust_analyzer = { settings = { ["rust-analyzer"] = { procMacro = { enable = true }, diagnostics = { disabled = { "unresolved-proc-macro" }, }, }, }, }, }, },}Because extras apply after user.lua, the extra’s own defaults win if you set
the same exact keys, such as check.command. If you need to change those
defaults, make a small local extra or contribute a Blak option for that behavior.
Configure formatting
Section titled “Configure formatting”The default uses external formatters where available and falls back to LSP:
return { extras = { enabled = { "lang.rust" }, }, format = { formatters_by_ft = { rust = { "rustfmt", lsp_format = "fallback" }, toml = { "taplo", lsp_format = "fallback" }, }, },}Tooling notes
Section titled “Tooling notes”Install Rust itself outside Blak:
rustup component add rust-analyzer rustfmt clippyBlak installs codelldb through Mason because that tool is editor-facing and
works well as a Mason-managed binary.
Install and verify
Section titled “Install and verify”:BlakExtras sync:BlakToolsInstall:BlakTreesitterInstall:BlakDoctorOpen a Rust file and check :LspInfo for rust_analyzer.