Skip to content

Commit

Permalink
feat(pack): switch to codelldb for rust debugging (#106)
Browse files Browse the repository at this point in the history
* feat!: switch to codelldb for rust debugging

* fix: use mason's API for installation path

* fix: cleaner use of the mason api

Co-authored-by: Micah Halter <micah@mehalter.com>

* refactor: clean up code a bit

Co-authored-by: Oli <57495944+owittek@users.noreply.github.com>

---------

Co-authored-by: Micah Halter <micah@mehalter.com>
Co-authored-by: Oli <57495944+owittek@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 29, 2023
1 parent c6771c0 commit 2005cf2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 0 additions & 2 deletions lua/astrocommunity/pack/rust/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Rust Language Pack

Requires `lldb-vscode` in your `PATH`

This plugin pack does the following:

- Adds `rust` Treesitter parsers
Expand Down
16 changes: 15 additions & 1 deletion lua/astrocommunity/pack/rust/rust.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,21 @@ return {
"simrat39/rust-tools.nvim",
ft = { "rust" },
init = function() utils.list_insert_unique(astronvim.lsp.skip_setup, "rust_analyzer") end,
opts = function() return { server = require("astronvim.utils.lsp").config "rust_analyzer" } end,
opts = function()
local package_path = require("mason-registry").get_package("codelldb"):get_install_path()
local codelldb_path = package_path .. "/codelldb"
local liblldb_path = package_path .. "/extension/lldb/lib/liblldb"

return {
server = require("astronvim.utils.lsp").config "rust_analyzer",
dap = {
adapter = require("rust-tools.dap").get_codelldb_adapter(
codelldb_path,
liblldb_path .. (vim.loop.os_uname().sysname == "Linux" and ".so" or ".dylib")
),
},
}
end,
dependencies = {
{
"jay-babu/mason-nvim-dap.nvim",
Expand Down

0 comments on commit 2005cf2

Please sign in to comment.