From a9c683440a166698bebe65cc3f28a94e50049a08 Mon Sep 17 00:00:00 2001 From: kalmenn Date: Sat, 30 Dec 2023 12:17:59 +0100 Subject: [PATCH] lsp: don't manually setup rust-analyzer. rust-tools already does --- lua/plugins/lsp.lua | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 9d0467b..516ee54 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -41,10 +41,6 @@ return { capabilities = capabilities, }) - lspconfig.rust_analyzer.setup({ - capabilities = capabilities, - }) - lspconfig.lua_ls.setup({ capabilities = capabilities, settings = { @@ -109,17 +105,22 @@ return { event = "BufEnter Cargo.toml", }, }, - opts = { - server = { - on_attach = function(_, bufnr) - local rt = require("rust-tools"); - -- Hover actions - vim.keymap.set("n", "", rt.hover_actions.hover_actions, { buffer = bufnr }) - -- Code action groups - vim.keymap.set("n", "a", rt.code_action_group.code_action_group, { buffer = bufnr }) - end, - }, - }, - event = { "LspAttach *.rs" }, + lazy = false, + config = function() + local capabilities = require("cmp_nvim_lsp").default_capabilities(); + + require("rust-tools").setup({ + server = { + on_attach = function(_, bufnr) + local rt = require("rust-tools"); + -- Hover actions + vim.keymap.set("n", "", rt.hover_actions.hover_actions, { buffer = bufnr }) + -- Code action groups + vim.keymap.set("n", "a", rt.code_action_group.code_action_group, { buffer = bufnr }) + end, + capabilities = capabilities, + }, + }); + end, } }