The unofficial VS Code Go companion to the official Go extension that provides experimental features.
Report issues to vscode-go. Include a note that you are reporting an issue or request for Go Companion.
Go Companion includes an experimental alternative to vscode-go's test explorer that uses the Go language server (gopls) for test discovery, allowing for more advanced test discovery such as static detection of (some) subtests. Additionally, Go Companion provides the following features:
- Ignore tests within specified files.
- Disable automatic discovery of tests.
- Control how tests are displayed.
- Debugging a test updates its status in the test explorer.
- Support for continuous runs.
- Code lenses (hidden by default) that are integrated with the test explorer.
See settings for more details.
Coverage is supported through VSCode's test coverage API. The coverage scope (as in, show coverage for the current package or for the entire module) may be configured with the "Configure Coverage Run Profile" command. This is a workaround for microsoft/vscode#237106.
Go Companion supports profiling tests and includes a pprof profile viewer that is more cleanly integrated with the editor than vscode-go's iframe-based viewer. To profile tests:
- Run
Configure Test Profiles
- Select
Run - Go (experimental)
- Select
Profiling
- Select the profiles you wish to capture
- Hit
[Enter]
to save your selection - Run a test
- There will now be a
Profiles
item under the test - Open
Profiles
- Open the profile set, e.g.
12:34:56
- Open the profile, e.g.
CPU
, by double clicking the item or clicking the open symbol
If multiple tests are run with profiling enabled, Profiles
will appear under
the package instead of the individual test.
Go Companion provides a command and editor context menu item for rendering package documentation. Right click a declaration in a Go file and select "Go Companion: Render Documentation":