Skip to content

Commit bb3600b

Browse files
committed
rust utils
1 parent b5f9757 commit bb3600b

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

modules/home/common/nvim/lua/lsp.lua

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,30 @@ vim.lsp.config("fish", {
171171
root_dir = root_dir(),
172172
})
173173

174-
vim.lsp.enable({ "gopls", "typos-lsp", "nixd", "templ", "javascript", "lua_ls", "harper", "fish" })
174+
vim.lsp.config("rust_analyzer", {
175+
cmd = { "rust-analyzer" },
176+
filetypes = { "rust" },
177+
root_dir = root_dir({ "Cargo.toml" }),
178+
capabilities = {
179+
experimental = {
180+
serverStatusNotification = true,
181+
},
182+
},
183+
before_init = function(init_params, config)
184+
if config.settings and config.settings["rust-analyzer"] then
185+
init_params.initializationOptions = config.settings["rust-analyzer"]
186+
end
187+
end,
188+
})
189+
190+
vim.lsp.enable({
191+
"gopls",
192+
"typos-lsp",
193+
"nixd",
194+
"templ",
195+
"javascript",
196+
"lua_ls",
197+
"harper",
198+
"fish",
199+
"rust_analyzer",
200+
})

modules/home/common/nvim/lua/plugins.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ return inject_all({
144144
javascript = { "prettier" },
145145
lua = { "stylua" },
146146
nix = { "alejandra" },
147+
rust = { "rustfmt" },
147148
templ = { "templ", "injected" },
148149
["*"] = function(bufnr)
149150
if vim.fn.getbufvar(bufnr, "&filetype") == "terraform" then

0 commit comments

Comments
 (0)