find rust-analyzer automatically and display error when not found
This commit is contained in:
@@ -171,8 +171,15 @@ return {
|
|||||||
lazy = false,
|
lazy = false,
|
||||||
ft = { "rust" },
|
ft = { "rust" },
|
||||||
config = function()
|
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 = {
|
vim.g.rustaceanvim = {
|
||||||
server = {
|
server = {
|
||||||
|
cmd = { rust_analyzer_path },
|
||||||
on_attach = lsp_attach,
|
on_attach = lsp_attach,
|
||||||
settings = {
|
settings = {
|
||||||
-- rust-analyzer language server configuration
|
-- rust-analyzer language server configuration
|
||||||
|
Reference in New Issue
Block a user