idanarye / vim-vebugger

Yes, we do need another debugger plugin
http://www.vim.org/scripts/script.php?script_id=4941
424 stars 35 forks source link

Debug Adapter Protocol Support #66

Open tbo opened 6 years ago

tbo commented 6 years ago

I think support for the Debug Adapter Protocol would be an nice addition to this plugin and extend its usage to more languages. It might even eliminate the necessity to maintain support for most, if not all, wrappers.

https://microsoft.github.io/debug-adapter-protocol/

idanarye commented 6 years ago

Not that trivial. DAP seems to be designed for RPC, while Vebugger is designed to handle command line debuggers.

tbo commented 6 years ago

I think, that a lot of debug adapters interact with command line adapters as well (e.g. https://marketplace.visualstudio.com/items?itemName=webfreak.debug). They just expose the functionality via a high level API. I would expect, that most vebugger write actions can directly be mapped to DAP Requests. I created a (very) high-level mapping of vebugger commands to DAP Requests:

VBGstepOver -> Next
VBGstepIn -> StepIn
VBGstepOut -> StepOut
VBGcontinue -> Continue

VBGtoggleBreakpoint -> SetBreakPoints
VBGtoggleBreakpointThisLine -> SetBreakPoints
VBGclearBreakpoints -> SetBreakPoints

VBGeval -> Evaluate
VBGevalSelectedText -> Evaluate
VBGevalWordUnderCursor -> Evaluate

VBGexecute -> ? (maybe Evaluate)
VBGexecuteSelectedText -> ? (maybe Evaluate)

VBGkill -> Disconnect or Terminate

VBGtoggleTerminalBuffer <- RunInTerminal
VBGrawWrite -> ?
VBGrawWriteSelectedText -> ?

The part, that would likely differ the most is the debugger feedback. I don't know how well DAP's event model would fit into vebugger'a read handler model. There are probably a lot of things, that I'm missing here. @idanarye Would you say, that it makes sense to implement this in vebugger? I would otherwise checkout a NodeJs based solution, since there already is a complete SDK for it (https://github.com/Microsoft/vscode-debugadapter-node).