jbyuki/one-small-step-for-vimkind

Can dap continue launch the lua file?

Closed this issue · 1 comments

With Python and Rust, when doing dap continue it is able to launch the debugger.

With osv I could only achieve debugging using require'osv'.run_this() to achieve the same.
This means that key maps need to be different between lua and other languages.

Is there a way to configure osv or dap so the same technique of dap continue will work also for lua debugging?

Osv works with continue() as well but it might work differently from what you expect. continue() can work in two ways in dap:

  • Attach mode : this will attach the nvim-dap client to an already running executable.
  • Launch mode: nvim-dap will launch the executable itself and attach to it.

Probably your configuration for python and rust works in launch mode. run_this() also does that to some extent. As you might have guessed osv works primarily in an attach mode, meaning you need to launch a separate instance of neovim manually and use continue(). See the documentation on how to use it.

If you really want to have a launch configuration, it's technically possible. The creator of nvim-dap has made one which only works with alacritty available here: https://github.com/mfussenegger/dotfiles/blob/2428fc92505bb5aa5c48d475f1f7a23cbf64fc00/vim/.config/nvim/ftplugin/lua.lua#L3-L43 . But if you have tmux or something similar, opening a new neovim instance should just be a few keystrokes away.

Also note that osv is primarily used to debug plugin where you almost always need a separate neovim instance so it either needs to be launched manually or via a launcher script.