golang / vscode-go

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

edit default .vscode/launch.js "Launch Package" program work dir #3387

Closed yimiaoxiehou closed 4 weeks ago

yimiaoxiehou commented 1 month ago

By default, the working directory for the “Launch Package” program in .vscode/launch.js is set to “${fileDirname}”, which is the .vscode directory. This is merely the configuration directory for VSCode, not the base directory of the Go project, so it cannot directly run the project and always requires modification. I believe this is not very convenient for developers.

yimiaoxiehou commented 1 month ago

3388

hyangah commented 1 month ago

To clarify - the ${fileDirname} is the current opened file's folder path, not the .vscode/launch.json's directory.

If you move the focus to any source file of tested or built package, use of ${fileDirname} allows to debug the package. The intention was to be able to use the same config for any packages in the project as users often work on multiple packages. OTOH, I am now confused by the use of placeholder with ${fileDirname}.

I personally think ${fileDirname} makes more sense when working with "mode": "auto" - which switches the debug mode depending on the open source code, but I see the other side of an argument too since this is to supply a "template", rather than the final launch configuration.

@suzmue This is separate from the configuration used by the no-config debug or test debugging, right? Then, I am fine with this change.

gopherbot commented 4 weeks ago

Change https://go.dev/cl/585615 mentions this issue: extension/package.json: edit default launch package dir