feat(nvim): enable rust lsp support
This commit is contained in:
parent
c9cc4f5088
commit
920f98ca75
@ -32,6 +32,7 @@
|
|||||||
terraform-ls
|
terraform-ls
|
||||||
tflint
|
tflint
|
||||||
nodePackages.bash-language-server
|
nodePackages.bash-language-server
|
||||||
|
rust-analyzer
|
||||||
];
|
];
|
||||||
|
|
||||||
stateVersion = "22.05";
|
stateVersion = "22.05";
|
||||||
@ -143,6 +144,7 @@
|
|||||||
# LSP
|
# LSP
|
||||||
nvim-lspconfig
|
nvim-lspconfig
|
||||||
lsp-status-nvim
|
lsp-status-nvim
|
||||||
|
rust-tools-nvim
|
||||||
];
|
];
|
||||||
|
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
@ -150,6 +152,7 @@
|
|||||||
${builtins.readFile ./nvim/lua/keymaps.lua }
|
${builtins.readFile ./nvim/lua/keymaps.lua }
|
||||||
${builtins.readFile ./nvim/lua/options.lua }
|
${builtins.readFile ./nvim/lua/options.lua }
|
||||||
${builtins.readFile ./nvim/lua/plugins/treesitter.lua }
|
${builtins.readFile ./nvim/lua/plugins/treesitter.lua }
|
||||||
|
|
||||||
${builtins.readFile ./nvim/lua/plugins/lspconfig.lua }
|
${builtins.readFile ./nvim/lua/plugins/lspconfig.lua }
|
||||||
|
|
||||||
require("toggleterm").setup({ size = 32, open_mapping = [[<F4>]] })
|
require("toggleterm").setup({ size = 32, open_mapping = [[<F4>]] })
|
||||||
|
@ -27,7 +27,7 @@ local on_attach = function(client, bufnr)
|
|||||||
group = augroup,
|
group = augroup,
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.lsp.buf.formatting_sync()
|
vim.lsp.buf.formatting_sync({}, 3000)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@ -63,10 +63,28 @@ local servers = {
|
|||||||
|
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
for lsp, config in pairs(servers) do
|
for lsp, settings in pairs(servers) do
|
||||||
lspconfig[lsp].setup({
|
lspconfig[lsp].setup({
|
||||||
settings = config or {},
|
settings = settings,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
})
|
})
|
||||||
end
|
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