golang / vscode-go

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

configure dlvFlags when running tests #1723

Closed snigle closed 3 years ago

snigle commented 3 years ago

Is your feature request related to a problem? Please describe. In my dev environment I need to pass some flags to dlv-dap to works. It's works when running a package main with dlvFlags option in launch config. But when I want to debug the test execution, I would like to configure it here also.

Describe the solution you'd like A settings go.testDlvFlags : [] to add in the debug test config : https://github.com/golang/vscode-go/blob/master/src/goTest.ts#L228$

Describe alternatives you've considered In workaround I will create a binary of dlv-dap to set my flags by default

hyangah commented 3 years ago

I think having proper debug settings (e.g. go.debug.delveFlags, go.debug.substitutePath, go.debug.logOutput, ... ) to override the default, or extending the existing go.delveConfig to accept some launch config can be an alternative to https://github.com/golang/vscode-go/issues/855

@polinasok @suzmue

polinasok commented 3 years ago

I think having proper debug settings (e.g. go.debug.delveFlags, go.debug.substitutePath, go.debug.logOutput, ... ) to override the default, or extending the existing go.delveConfig to accept some launch config can be an alternative to #855

So in other words, you propose that we put many of the flags available in launch.json into settings.json (global vs workspace-specific)? Then users could specify most settings things there and override in launch.json for individual sessions?

This could be powerful, but also add more confusion. Right now when you mouse-over a field in launch.json, it shows the defaults from package.json. Would it be possible to somehow channel the true defaults from settings.json in that hover or in some other way? Or maybe we need to invest in logging both configurations with a clear this-overrides-that presentation on start-up to make clear to the users.

hyangah commented 3 years ago

I think having proper debug settings (e.g. go.debug.delveFlags, go.debug.substitutePath, go.debug.logOutput, ... ) to override the default, or extending the existing go.delveConfig to accept some launch config can be an alternative to #855

So in other words, you propose that we put many of the flags available in launch.json into settings.json (global vs workspace-specific)? Then users could specify most settings things there and override in launch.json for individual sessions?

Not all the settings from launch.json. Only those that make sense to apply to all launch.json. go.delveConfig already set a precedent and it seems like users used it without much confusion for a long period of time.

Channeling the true defaults from settings.json is not possible as far as I know since the UI + intellisense over launch.json is done completely outside of the extension. Maybe we can log more to make it clear if that helps.

gopherbot commented 3 years ago

Change https://golang.org/cl/351249 mentions this issue: package.json: add showLog/logOutput/dlvFlags to go.delveConfig setting