You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
launcher.lua: dap.repl left as a truthy error string when nvim-dap isn't installed, would crash on use #332
pcall(f, ...) returns (ok, result_or_error). When require("dap.repl")fails (e.g. nvim-dap isn't installed), ok is false and the second return value is the error message string (something like "module 'dap.repl' not found: ..."), not nil. The code discards ok (via _) and unconditionally assigns the second value to repl/deps.dap_repl — so on failure, deps.dap_repl ends up being a truthy string instead of nil.
Impact
Later code in the same file does:
ifreplthenrepl.clear()
-- orrepl.append(data)
end
Since a plain string is truthy, this branch is taken even when dap.repl failed to load, and repl.clear()/repl.append(...) would then crash with something like attempt to call a string value.
Why this apparently never manifested in production
core/spec_builder/init.lua already asserts require("dap") succeeds before ever reaching launch_debug_test, for the strategy = "dap" code path — so in practice, by the time this code runs, nvim-dap (and therefore dap.repl) is virtually always already present. The bug is real but was effectively unreachable via the plugin's own normal call path. It became directly observable when writing an isolated unit/integration test for launcher.lua (as part of #317's plenary.nvim removal work) with nvim-dap not present in the test's runtime.
Fix
Already fixed in #330 (part of the plenary.nvim removal PR stack):
Activity