Skip to content

Commit

Permalink
Add way to provide extra initCommands
Browse files Browse the repository at this point in the history
  • Loading branch information
Thore Goll committed Jan 16, 2025
1 parent 10efd4d commit 616cd7b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lua/rustaceanvim/commands/debuggables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ local function add_debuggables_to_nvim_dap(debuggables)
local name = 'Cargo: ' .. build_label(debuggable.args)
if not _dap_configuration_added[name] then
configuration.name = name
if configuration.initCommands == nil then
configuration.initCommands = {}
end
if config.dap.init_commands ~= nil then
table.insert(configuration.initCommands, config.dap.init_commands)
end
table.insert(dap.configurations.rust, configuration)
_dap_configuration_added[name] = true
end
Expand Down
3 changes: 3 additions & 0 deletions lua/rustaceanvim/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ vim.g.rustaceanvim = vim.g.rustaceanvim
---Whether to get Rust types via initCommands (rustlib/etc/lldb_commands, lldb only).
---Default: `true`.
---@field load_rust_types? fun():boolean | boolean
---
---Extra initCommand to apply to all debuggable targets
---@field init_commands? string

---@alias rustaceanvim.dap.Command string

Expand Down
2 changes: 2 additions & 0 deletions lua/rustaceanvim/config/internal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,8 @@ local RustaceanDefaultConfig = {
local type = is_codelldb_adapter(adapter) and 'codelldb' or 'lldb'
return load_dap_configuration(type)
end,
---@type string?
init_commands = nil,
},
-- debug info
was_g_rustaceanvim_sourced = vim.g.rustaceanvim ~= nil,
Expand Down

0 comments on commit 616cd7b

Please sign in to comment.