find rust-analyzer automatically and display error when not found
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user