Skip to content

firelizzard18/exp-vscode-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7a0a3f0 · Feb 26, 2025
Nov 20, 2024
Sep 22, 2024
Nov 20, 2024
Feb 26, 2025
Nov 13, 2024
Dec 7, 2024
Nov 20, 2024
Sep 22, 2024
Jul 22, 2024
Sep 22, 2024
Sep 22, 2024
Jul 22, 2024
Jul 18, 2024
Jul 18, 2024
Feb 26, 2025
Jul 18, 2024
Feb 26, 2025
Oct 6, 2024
Oct 1, 2024
Oct 5, 2024
Feb 26, 2025
Nov 16, 2024

Repository files navigation

Go Companion

The unofficial companion to the official Go extension that provides experimental features.

Go Companion is intended to be used with prerelease versions of the Go extension and requires gopls v0.17.0 or later. The user experience may be somewhat degraded when used with release versions of the Go extension.

Issues

Report issues to vscode-go. Include a note that you are reporting an issue or request for Go Companion.

Test Explorer

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.

More detailed descriptions of these settings are provided in VSCode's settings editor.

Coverage

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.

Profiling

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:

  1. Run Configure Test Profiles
  2. Select Run - Go (experimental)
  3. Select Profiling
  4. Select the profiles you wish to capture
  5. Hit [Enter] to save your selection
  6. Run a test
  7. There will now be a Profiles item under the test
  8. Open Profiles
  9. Open the profile set, e.g. 12:34:56
  10. Open the profile, e.g. CPU, by double clicking the item or clicking the open symbol

profiles

If multiple tests are run with profiling enabled, Profiles will appear under the package instead of the individual test.

cpu-pprof

Documentation Viewer

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":

doc-viewer