1
0
mirror of https://github.com/golang/go synced 2024-11-19 06:24:41 -07:00
go/gopls/doc/vscode.md
Rebecca Stambler 96954830e1 gopls/doc: add and make minor changes to documentation
Change-Id: Ibb7d7715541ee2a712dd6927abceadc45ec60b41
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195517
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-09-16 01:38:12 +00:00

51 lines
1.8 KiB
Markdown

# VSCode
Use the [VSCode-Go] plugin, with the following configuration:
```json5
"go.useLanguageServer": true,
"[go]": {
"editor.snippetSuggestions": "none",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true,
}
},
"gopls": {
"usePlaceholders": true, // add parameter placeholders when completing a function
// ----- Experimental settings -----
"completeUnimported": true, // autocomplete unimported packages
"watchChangedFiles": true, // watch file changes outside of the editor
"deepComplete": true, // deep completion
},
"files.eol": "\n", // formatting only supports LF line endings
```
VSCode will complain about the `"gopls"` settings, but they will still work. Once we have a consistent set of settings, we will make the changes in the VSCode plugin necessary to remove the errors.
If you encounter problems with import organization, please try setting a higher code action timeout (any value greater than 750ms), for example:
```json5
"[go]": {
"editor.codeActionsOnSaveTimeout": 3000
}
```
To enable more detailed debug information, add the following to your VSCode settings:
```json5
"go.languageServerFlags": [
"-rpc.trace", // for more detailed debug logging
"serve",
"--debug=localhost:6060", // to investigate memory usage, see profiles
],
```
See the section on [command line](command-line.md) arguments for more information about what these do, along with other things like `--logfile=auto` that you might want to use.
You can disable features through the `"go.languageServerExperimentalFeatures"` section of the config. An example of a feature you may want to disable is `"documentLink"`, which opens [`godoc.org`](https://godoc.org) links when you click on import statements in your file.
[VSCode-Go]: https://github.com/microsoft/vscode-go