diff options
| author | 2025-03-30 13:58:24 +0300 | |
|---|---|---|
| committer | 2025-03-30 13:58:24 +0300 | |
| commit | 3c661562f42ad87e1aefaad163c2df6d14ab5a32 (patch) | |
| tree | eeea535b82f223b37f15a4bb18a9f531204f621e | |
| parent | feat: use `conform.nvim` for `formatexpr()` (diff) | |
| download | neovim-configuration-3c661562f42ad87e1aefaad163c2df6d14ab5a32.tar.gz neovim-configuration-3c661562f42ad87e1aefaad163c2df6d14ab5a32.tar.bz2 neovim-configuration-3c661562f42ad87e1aefaad163c2df6d14ab5a32.tar.lz neovim-configuration-3c661562f42ad87e1aefaad163c2df6d14ab5a32.tar.xz neovim-configuration-3c661562f42ad87e1aefaad163c2df6d14ab5a32.tar.zst neovim-configuration-3c661562f42ad87e1aefaad163c2df6d14ab5a32.zip | |
feat: add `rust-analyzer` as Rust LSP
Diffstat (limited to '')
| -rw-r--r-- | flake.nix | 8 | ||||
| -rw-r--r-- | lsp/rust-analyzer.lua | 26 | ||||
| -rw-r--r-- | lua/config/lsp.lua | 1 | ||||
| -rw-r--r-- | lua/config/plugins/formatting.lua | 1 |
4 files changed, 36 insertions, 0 deletions
@@ -129,11 +129,19 @@ lua-language-server stylua ]; + nix = [ nix-doc nixd nixfmt-rfc-style ]; + + rust = [ + # NOTE: required to find project root + # NOTE: for now unused, so commented out + # cargo + rust-analyzer + ]; }; }; diff --git a/lsp/rust-analyzer.lua b/lsp/rust-analyzer.lua new file mode 100644 index 0000000..51f5037 --- /dev/null +++ b/lsp/rust-analyzer.lua @@ -0,0 +1,26 @@ +return { + cmd = { "rust-analyzer" }, + root_markers = { "Cargo.toml" }, + filetypes = { "rust" }, + + settings = { + ["rust-analyzer"] = { + checkOnSave = { command = "clippy" }, + + diagnostics = { + enable = true, + experimental = { enable = true }, + }, + + inlayHints = { + enable = true, + bindingModeHints = { enable = false }, + closingBraceHints = { minLines = 10 }, + closureReturnTypeHints = { enable = "with_block" }, + discriminantHints = { enable = "fieldless" }, + lifetimeElisionHints = { enable = "skip_trivial" }, + typeHints = { hideClosureInitialization = false }, + }, + }, + }, +} diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua index 37e3b6f..6d4a680 100644 --- a/lua/config/lsp.lua +++ b/lua/config/lsp.lua @@ -1,2 +1,3 @@ vim.lsp.enable("lua-language-server") vim.lsp.enable("nixd") +vim.lsp.enable("rust-analyzer") diff --git a/lua/config/plugins/formatting.lua b/lua/config/plugins/formatting.lua index 8a4c6ab..9563905 100644 --- a/lua/config/plugins/formatting.lua +++ b/lua/config/plugins/formatting.lua @@ -9,6 +9,7 @@ return { formatters_by_ft = { lua = { "stylua" }, nix = { "nixfmt" }, + rust = { "rustfmt", lsp_format = "fallback" }, }, }) |
