diff --git a/lua/modules/configs/completion/mason-lspconfig.lua b/lua/modules/configs/completion/mason-lspconfig.lua index fdf54587c..eb534cbf2 100644 --- a/lua/modules/configs/completion/mason-lspconfig.lua +++ b/lua/modules/configs/completion/mason-lspconfig.lua @@ -28,6 +28,23 @@ M.setup = function() ---A handler to setup all servers defined under `completion/servers/*.lua` ---@param lsp_name string local function mason_lsp_handler(lsp_name) + -- rust_analyzer is configured using mrcjkb/rustaceanvim + -- warn users if they have set it up manually + if lsp_name == "rust_analyzer" then + local config_exist = pcall(require, "completion.servers." .. lsp_name) + if config_exist then + vim.notify( + [[ +`rust_analyzer` is configured independently via `mrcjkb/rustaceanvim`. To get rid of this warning, +please REMOVE your LSP configuration (rust_analyzer.lua) from the `servers` directory and configure +`rust_analyzer` using the appropriate init options provided by `rustaceanvim` instead.]], + vim.log.levels.WARN, + { title = "nvim-lspconfig" } + ) + end + return + end + local ok, custom_handler = pcall(require, "user.configs.lsp-servers." .. lsp_name) -- Use preset if there is no user definition if not ok then diff --git a/lua/modules/configs/lang/rust.lua b/lua/modules/configs/lang/rust.lua index c5cc4c01b..952c7c70d 100644 --- a/lua/modules/configs/lang/rust.lua +++ b/lua/modules/configs/lang/rust.lua @@ -1,12 +1,8 @@ return function() vim.g.rustaceanvim = { - -- DAP configuration - dap = { - adapter = { - type = "executable", - command = "lldb-vscode", - name = "rt_lldb", - }, - }, + -- Disable automatic DAP configuration to avoid conflicts with previous user configs + dap = { adapter = false, configuration = false }, } + + require("modules.utils").load_plugin("rustaceanvim", nil, true) end