feat(nvim): enable rust lsp support
This commit is contained in:
parent
c9cc4f5088
commit
920f98ca75
2 changed files with 24 additions and 3 deletions
|
@ -27,7 +27,7 @@ local on_attach = function(client, bufnr)
|
|||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.formatting_sync()
|
||||
vim.lsp.buf.formatting_sync({}, 3000)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
@ -63,10 +63,28 @@ local servers = {
|
|||
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
for lsp, config in pairs(servers) do
|
||||
for lsp, settings in pairs(servers) do
|
||||
lspconfig[lsp].setup({
|
||||
settings = config or {},
|
||||
settings = settings,
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end
|
||||
|
||||
require("rust-tools").setup({
|
||||
server = {
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
cargo = {
|
||||
loadOutDirsFromCheck = true,
|
||||
},
|
||||
checkOnSave = { command = "clippy" },
|
||||
procMacro = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
capabilities = capabilities,
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue