2 { "Saecki/crates.nvim",
3 event = { "BufRead Cargo.toml" },
18 { "nvim-treesitter/nvim-treesitter",
19 opts = { ensure_installed = { "rust", "ron" } },
21 { "williamboman/mason.nvim",
23 opts = function(_, opts)
24 opts.ensure_installed = opts.ensure_installed or {}
25 vim.list_extend(opts.ensure_installed, { "codelldb" })
28 { "mrcjkb/rustaceanvim",
29 version = vim.fn.has("nvim-0.10.0") == 0 and "^4" or false,
33 on_attach = function(_, bufnr)
34 vim.keymap.set("n", "<leader>cR", function()
35 vim.cmd.RustLsp("codeAction")
36 end, { desc = "Code Action", buffer = bufnr })
37 vim.keymap.set("n", "<leader>dr", function()
38 vim.cmd.RustLsp("debuggables")
39 end, { desc = "Rust Debuggables", buffer = bufnr })
42 -- rust-analyzer language server configuration
46 loadOutDirsFromCheck = true,
51 -- Add clippy lints for Rust if using rust-analyzer
53 -- Enable diagnostics if using rust-analyzer
60 ["async-trait"] = { "async_trait" },
61 ["napi-derive"] = { "napi" },
62 ["async-recursion"] = { "async_recursion" },
82 config = function(_, opts)
83 local package_path = require("mason-registry").get_package("codelldb"):get_install_path()
84 local codelldb = package_path .. "/extension/adapter/codelldb"
85 local library_path = package_path .. "/extension/lldb/lib/liblldb.dylib"
86 local uname = io.popen("uname"):read("*l")
87 if uname == "Linux" then
88 library_path = package_path .. "/extension/lldb/lib/liblldb.so"
91 adapter = require("rustaceanvim.config").get_codelldb_adapter(codelldb, library_path),
93 vim.g.rustaceanvim = vim.tbl_deep_extend("keep", vim.g.rustaceanvim or {}, opts or {})
94 if vim.fn.executable("rust-analyzer") == 0 then
96 "**rust-analyzer** not found in PATH, please install it.\nhttps://rust-analyzer.github.io/",
97 { title = "rustaceanvim" }
102 { "neovim/nvim-lspconfig",
105 rust_analyzer = { enabled = false }, -- rustaceanvim is used instead
109 { "nvim-neotest/neotest",
113 ["rustaceanvim.neotest"] = {},