From 82af4d91d4d09d70cfeffb04e3d16993c52f0446 Mon Sep 17 00:00:00 2001 From: Fabian Schmidt Date: Mon, 22 Sep 2025 09:50:27 +0200 Subject: [PATCH] find rust-analyzer automatically and display error when not found --- lua/plugins/lsp.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index e989591..3570471 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -171,8 +171,15 @@ return { lazy = false, ft = { "rust" }, config = function() + local rust_analyzer_path = vim.fn.trim(vim.fn.system("rustup which rust-analyzer")) + if rust_analyzer_path == "" then + vim.notify("rust-analyzer not found! Install it with: rustup component add rust-analyzer", + vim.log.levels.ERROR) + return + end vim.g.rustaceanvim = { server = { + cmd = { rust_analyzer_path }, on_attach = lsp_attach, settings = { -- rust-analyzer language server configuration