feat(nvim): enable rust lsp support
This commit is contained in:
parent
c9cc4f5088
commit
920f98ca75
@ -32,6 +32,7 @@
|
||||
terraform-ls
|
||||
tflint
|
||||
nodePackages.bash-language-server
|
||||
rust-analyzer
|
||||
];
|
||||
|
||||
stateVersion = "22.05";
|
||||
@ -143,6 +144,7 @@
|
||||
# LSP
|
||||
nvim-lspconfig
|
||||
lsp-status-nvim
|
||||
rust-tools-nvim
|
||||
];
|
||||
|
||||
extraConfig = ''
|
||||
@ -150,6 +152,7 @@
|
||||
${builtins.readFile ./nvim/lua/keymaps.lua }
|
||||
${builtins.readFile ./nvim/lua/options.lua }
|
||||
${builtins.readFile ./nvim/lua/plugins/treesitter.lua }
|
||||
|
||||
${builtins.readFile ./nvim/lua/plugins/lspconfig.lua }
|
||||
|
||||
require("toggleterm").setup({ size = 32, open_mapping = [[<F4>]] })
|
||||
|
@ -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,
|
||||
},
|
||||
})
|
||||
|
Reference in New Issue
Block a user