Fix codelldb configuration for linux / mac

This commit is contained in:
Bigo 2024-11-14 10:49:12 +00:00
parent 66d80b652a
commit 5752f38c13
No known key found for this signature in database
GPG key ID: AEFBBD3BE8C66E4A

View file

@ -97,13 +97,15 @@ return {
},
},
config = function(_, opts)
-- Configure dap with codelldb
local package_path = require("mason-registry").get_package("codelldb"):get_install_path()
local codelldb = package_path .. "/extension/adapter/codelldb"
local library_path = package_path .. "/extension/lldb/lib/liblldb.dylib"
local uname = io.popen("uname"):read("*l")
if uname == "Linux" then
library_path = package_path .. "/extension/lldb/lib/liblldb.so"
end
opts.dap = {
adapter = require("rustaceanvim.config").get_codelldb_adapter(
package_path .. "/codelldb",
package_path .. "/extension/lldb/lib/liblldb.dylib"
),
adapter = require("rustaceanvim.config").get_codelldb_adapter(codelldb, library_path),
}
vim.g.rustaceanvim = vim.tbl_deep_extend("keep", vim.g.rustaceanvim or {}, opts or {})
if vim.fn.executable("rust-analyzer") == 0 then
@ -123,21 +125,6 @@ return {
bacon_ls = {
enabled = diagnostics == "bacon-ls",
},
taplo = {
keys = {
{
"K",
function()
if vim.fn.expand("%:t") == "Cargo.toml" and require("crates").popup_available() then
require("crates").show_popup()
else
vim.lsp.buf.hover()
end
end,
desc = "Show Crate Documentation",
},
},
},
rust_analyzer = { enabled = false },
},
},