@@ -157,7 +157,7 @@ local function get_lldb_commands(workspace_root)
157157end
158158
159159--- map for codelldb, list of strings for lldb-dap
160- --- @param adapter DapExecutableConfig | DapServerConfig | boolean
160+ --- @param adapter DapExecutableConfig | DapServerConfig
161161--- @param key string
162162--- @param segments string[]
163163--- @param sep string
176176local environments = {}
177177
178178-- Most succinct description: https://github.com/bevyengine/bevy/issues/2589#issuecomment-1753413600
179- --- @param adapter DapExecutableConfig | DapServerConfig | boolean
179+ --- @param adapter DapExecutableConfig | DapServerConfig
180180--- @param workspace_root string
181181local function add_dynamic_library_paths (adapter , workspace_root )
182182 compat .system ({ ' rustc' , ' --print' , ' target-libdir' }, nil , function (sc )
@@ -202,7 +202,7 @@ local function add_dynamic_library_paths(adapter, workspace_root)
202202 end )
203203end
204204
205- --- @param adapter DapExecutableConfig | DapServerConfig | boolean
205+ --- @param adapter DapExecutableConfig | DapServerConfig
206206--- @param args RADebuggableArgs
207207local function handle_configured_options (adapter , args )
208208 local is_generate_source_map_enabled = types .evaluate (config .dap .auto_generate_source_map )
228228function M .start (args )
229229 local adapter = types .evaluate (config .dap .adapter )
230230 --- @cast adapter DapExecutableConfig | DapServerConfig | disable
231+ if adapter == false then
232+ vim .notify (' Debug adapter is disabled.' , vim .log .levels .ERROR )
233+ return
234+ end
231235
232236 vim .notify (' Compiling a debug build for debugging. This might take some time...' )
233237 handle_configured_options (adapter , args )
@@ -282,12 +286,14 @@ function M.start(args)
282286 return
283287 end
284288
285- -- If the `lldb` adapter is not defined elsewhere, use the adapter
289+ -- If the adapter is not defined elsewhere, use the adapter
286290 -- defined in `config.dap.adapter`
287- if dap .adapters .lldb == nil then
291+ local is_codelldb = adapter .type == ' server'
292+ local adapter_key = is_codelldb and ' codelldb' or ' lldb'
293+ if dap .adapters [adapter_key ] == nil then
288294 --- @TODO: Add nvim-dap to lua-ls lint
289295 --- @diagnostic disable-next-line : assign-type-mismatch
290- dap .adapters . lldb = adapter
296+ dap .adapters [ adapter_key ] = adapter
291297 end
292298
293299 -- Use the first configuration, if it exists
0 commit comments