File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,11 @@ local rt = require("rust-tools")
22
33local M = {}
44
5+ local has_libs = {
6+ --- @type nil | boolean
7+ dap = nil ,
8+ }
9+
510--- For the heroes who want to use it
611--- @param codelldb_path string
712--- @param liblldb_path string
@@ -17,7 +22,7 @@ function M.get_codelldb_adapter(codelldb_path, liblldb_path)
1722 }
1823end
1924
20- function M . setup_adapter ()
25+ local function setup_adapter ()
2126 local dap = require (" dap" )
2227 local opts = rt .config .options
2328
@@ -50,7 +55,16 @@ local function scheduled_error(err)
5055end
5156
5257function M .start (args )
53- if not pcall (require , " dap" ) then
58+ if has_libs .dap == nil then
59+ if pcall (require , " dap" ) then
60+ has_libs .dap = true
61+ setup_adapter ()
62+ else
63+ has_libs .dap = false
64+ end
65+ end
66+
67+ if not has_libs .dap then
5468 scheduled_error (" nvim-dap not found." )
5569 return
5670 end
Original file line number Diff line number Diff line change @@ -127,10 +127,6 @@ function M.setup(opts)
127127 config .setup (opts )
128128 lsp .setup ()
129129 commands .setup_lsp_commands ()
130-
131- if pcall (require , " dap" ) then
132- rt_dap .setup_adapter ()
133- end
134130end
135131
136132return M
You can’t perform that action at this time.
0 commit comments