We welcome your contributions and thank you for working to improve the Go development experience in VS Code.
This guide will explain the process of setting up your development environment to work on the VS Code Go extension, as well as the process of sending out your change for review. If you're interested in testing the master branch or pre-releases of the extension, please see the Go Nightly documentation.
If you are interested in fixing a bug or contributing a feature, please file an issue first. Wait for a project maintainer to respond before you spend time coding.
If you wish to work on an existing issue, please add a comment saying so, as someone may already be working on it. A project maintainer may respond with advice on how to get started. If you're not sure which issues are available, search for issues with the help wanted label.
The VS Code Go maintainers are reachable via the issue tracker and the #vscode-dev channel in the Gophers Slack. Please reach out on Slack with questions, suggestions, or ideas. If you have trouble getting started on an issue, we'd be happy to give pointers and advice.
Please note that extra configuration is required to build and run the Debug Adapter, which controls the debugging features of this extension. Refer to the documentation for the Debug Adapter to set that up.
Install node. Note: make sure that you are using
npm v7 or higher. The file format for
package-lock.json (changed significantly)[https://docs.npmjs.com/cli/v7/configuring-npm/package-lock-json#file-format] in
Clone the repository, run
npm install, and open VS Code:
git clone https://go.googlesource.com/vscode-go cd vscode-go npm install code .
Make sure the
window.openFoldersInNewWindow setting is not
You can run
npm run lint on the command-line to check for lint errors in your program. You can also use the TSLint plugin to see errors as you code.
To run the extension with your patch, open the Run view (
Launch Extension, and click the Play button (
This will open a new VS Code window with the title
[Extension Development Host]. You can then open a folder that contains Go code and try out your changes.
You can also set breakpoints to debug your change.
If you make subsequent edits in the codebase, you can reload (
[Extension Development Host] instance of VS Code, which will load the new code. The debugger will automatically reattach.
Simple unit tests that do not require interaction with VS Code are located in
test/unit. Tests in
test/gopls directories are integration tests. They involve invocation of the VS Code API and require external Go tools installed in
GOPATH. The command
build/all.bash installs all the tool dependencies in
go.toolsGopath in case you installed the tools for testing in a different
There are currently three test launch configurations: (1)
Launch Extension Tests, (2)
Launch Extension Tests with Gopls, and (3)
Launch Unit Tests. To run the tests locally, open the Run view (
Ctrl+Shift+D), select the relevant launch configuration, and hit the Play button (
After making changes to the extension, you may want to test it end-to-end instead of running it in debug mode. To do this, you can sideload the extension.
Install the vsce tool for packaging extensions (
npm install -g vsce).
cd into your
Install all dependencies by running
vsce package. This will generate a file with a
.vsix extension in your current directory.
npm install -g vsce cd vscode-go npm install vsce package
Open a VS Code window, navigate to the Extensions view, and disable or uninstall the default Go extension.
Click on the “...” in the top-right corner, select “Install from VSIX...”, and choose the generated VSIX file. Alternatively, you can run
code --install-extension path/to/go.vsix or open the Command Palette and run the
Extensions: Install from VSIX... command.
In either case, code review will happen in Gerrit, which is used for all repositories in the Go project. GitHub pull requests will be mirrored into Gerrit, so you can follow a more traditional GitHub workflow, but you will still have to look at Gerrit to read comments.
The easiest way to start is by reading this detailed guide for contributing to the Go project. Important things to note are:
Once you‘ve sent out your change, a maintainer will take a look at your contribution within a few weeks. If you don’t hear back, feel free to ping the issue or send a message to the #vscode-dev channel of the Gophers Slack.
The extension's test suite will run on your change once it has been mailed. If you have contributed via a GitHub PR, the test results will be provided via a GitHub Action result on the PR. If you have mailed a Gerrit CL directly, tests will run in Google Cloud Build, and the results will be posted back on the CL.
Note that, as of June 2020, the GCB and Gerrit integration is not yet ready, so the results of the CI run will not appear on the Gerrit changelist. Instead, if your change fails on GCB, we will notify you and provide you with the relevant logs.