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")
2
2
3
3
local M = {}
4
4
5
+ local has_libs = {
6
+ --- @type nil | boolean
7
+ dap = nil ,
8
+ }
9
+
5
10
--- For the heroes who want to use it
6
11
--- @param codelldb_path string
7
12
--- @param liblldb_path string
@@ -17,7 +22,7 @@ function M.get_codelldb_adapter(codelldb_path, liblldb_path)
17
22
}
18
23
end
19
24
20
- function M . setup_adapter ()
25
+ local function setup_adapter ()
21
26
local dap = require (" dap" )
22
27
local opts = rt .config .options
23
28
@@ -50,7 +55,16 @@ local function scheduled_error(err)
50
55
end
51
56
52
57
function 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
54
68
scheduled_error (" nvim-dap not found." )
55
69
return
56
70
end
Original file line number Diff line number Diff line change @@ -127,10 +127,6 @@ function M.setup(opts)
127
127
config .setup (opts )
128
128
lsp .setup ()
129
129
commands .setup_lsp_commands ()
130
-
131
- if pcall (require , " dap" ) then
132
- rt_dap .setup_adapter ()
133
- end
134
130
end
135
131
136
132
return M
You can’t perform that action at this time.
0 commit comments