You can set up a development environment for debugging the extension during extension development.
Ensure you have node installed. Clone the repo, run npm install
and open a development instance of Code.
git clone https://github.com/Microsoft/vscode-go cd vscode-go npm install code .
Make sure the window.openFoldersInNewWindow
setting is not "on"
.
You can now go to the Debug viewlet (Ctrl+Shift+D
) and select Launch Extension
then hit run (F5
).
This will open a new VS Code window which will have the title [Extension Development Host]
. In this window, open any folder with Go code.
In the original VS Code window, you can now add breakpoints which will be hit when you use any of the the plugin's features in the second window.
If you make edits in the extension .ts
files, just reload (cmd-r
) the [Extension Development Host]
instance of Code to load in the new extension code. The debugging instance will automatically reattach.
To debug the debugger, see the debugAdapter readme.
To run the tests locally, open the Debug viewlet (Ctrl+Shift+D
), select Launch Tests
, then hit run (F5
)
After making changes to the extension, you might want to test it end to end instead of running it in debug mode. To do this, you can sideload the extension. This can be done by preparing the extension and loading it directly.
npm install -g vsce
to make sure you have vsce installed globallygit clone https://github.com/Microsoft/vscode-go
to clone the repo if you havent already done socd vscode-go
npm install
to install dependencies if you havent already done sovsce package
to build the package. This will generate a file with extension vsix
Extensions: Install from VSIX...
, choose the vsix file generated in the previous stepIf you want to help with testing the next update to this extension or you want to use the latest features that arent released yet, its easy to do so. Please see Use the beta version of the Go extension