Skip to content

Commit

Permalink
fix(dap): ensure codelldb client type when using codelldb adapter (
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb authored Jan 9, 2024
1 parent eaa3296 commit 61ca8b7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- DAP: Don't load `lldb_commands` when using `codelldb`.
- DAP: Make sure the client configuration type is 'codelldb'
when using a 'codelldb' adapter.

## [3.12.2] - 2024-01-07

Expand Down
24 changes: 21 additions & 3 deletions lua/rustaceanvim/config/internal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ local function should_enable_dap_config_value(dap_adapter)
return vim.fn.executable('rustc') == 1
end

---@param adapter DapServerConfig | DapExecutableConfig
local function is_codelldb_adapter(adapter)
return adapter.type == 'server'
end

---@param adapter DapServerConfig | DapExecutableConfig
local function is_lldb_adapter(adapter)
return adapter.type == 'executable'
end

---@class RustaceanConfig
local RustaceanDefaultConfig = {
---@class RustaceanToolsConfig
Expand Down Expand Up @@ -274,8 +284,8 @@ local RustaceanDefaultConfig = {
return false
end
local adapter = types.evaluate(RustaceanConfig.dap.adapter)
--- @cast adapter DapExecutableConfig | DapServerConfig | disable
return adapter ~= false and adapter.type == 'executable'
---@cast adapter DapExecutableConfig | DapServerConfig | disable
return adapter ~= false and is_lldb_adapter(adapter)
end,
--- @type DapClientConfig | disable | fun():(DapClientConfig | disable)
configuration = function()
Expand All @@ -284,11 +294,19 @@ local RustaceanDefaultConfig = {
return false
end

local adapter = types.evaluate(RustaceanConfig.dap.adapter)
---@cast adapter DapExecutableConfig | DapServerConfig | disable
if adapter == false then
return false
end
---@cast adapter DapExecutableConfig | DapServerConfig
local type = is_codelldb_adapter(adapter) and 'codelldb' or 'lldb'

-- default
---@type DapClientConfig
local dap_config = {
name = 'Rust debug client',
type = 'lldb',
type = type,
request = 'launch',
stopOnEntry = false,
}
Expand Down

0 comments on commit 61ca8b7

Please sign in to comment.