golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.84k stars 735 forks source link

Allow Setting Suspended Breakpoints so that we can hit breakpoints in Loaded Plugins #2775

Open jasonwinterpixel opened 1 year ago

jasonwinterpixel commented 1 year ago

Is your feature request related to a problem? Please describe. It is difficult to hit a breakpoint inside a plugin that is loaded via plugin.Open

Describe the solution you'd like Dlv has the ability to set suspended breakpoints that are reloaded after plugin.Open is called. VSCode's dlv integration does not seem to use this system.

Describe alternatives you've considered Setting a breakpoint after plugin.Open is called, and then deactivating/reactivating all the breakpoints that I've set so that they are properly initialized.

Additional context Debug Console log output when dlv is loading configuration and VSCode is trying to set a breakpoint inside a plugin:

2023-05-17T15:21:36Z debug layer=dap [-> to client]{"seq":0,"type":"response","request_seq":4,"success":true,"command":"setBreakpoints","body":{"breakpoints":[{"verified":false,"message":"could not find file some_plugin/some_path/some_file.go","source":{}}]}}
jasonwinterpixel commented 1 year ago

VSCode's usage of the DAP should set suspended to true here if possible: https://pkg.go.dev/github.com/go-delve/delve/service/rpc2#CreateBreakpointIn

suzmue commented 1 year ago

I think this could be done on the delve side and BreakpointEvents could be used to update the DAP client when the plugin is loaded.

jasonwinterpixel commented 1 year ago

https://github.com/go-delve/delve/pull/3390

jknightdoeswork commented 1 year ago

@suzmue Requesting your engagement on the delv pull request. We are discussing user experience and how DAP should be properly implemented. Input from you or your team would be impactful.