-
Notifications
You must be signed in to change notification settings - Fork 755
faq
NOTE: Debugging has its own FAQ documentation.
The default syntax highlighting for Go files is provided by a TextMate rule embedded in VS Code, not by this extension.
For accurate syntax highlighting (including generics support), we recommend enabling
semantic highlighting
by turning on Gopls' ui.semanticTokens
setting.
"gopls": { "ui.semanticTokens": true }
If you are experiencing issues with syntax highlighting, first check if you are using semantic highlighting. In case you did not enable semantic highlighting, report the issues to the go-syntax project directly.
When you have multiple formatter extensions, be sure to set this extension as the default formatter for go language.
"[go]": {
"editor.defaultFormatter": "golang.go"
}
Formatting and organizing imports for Go are enabled by default. This is implemented by setting the language-specific editor settings, that take precedence over user/workspace editor settings.
You can choose to disable them by configuring the following settings.
"[go]": {
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.organizeImports": false
}
}
This decision was made a while ago to help users follow the best practice, and to detect broken code early (e.g. unused imports causes compile errors in Go). Unfortunately, these language-specific editor settings overriden by the extension is not easily visible from the settings UI, and confuses users new to Go. In the following issues, we are discussing and collecting ideas to improve the situation without interrupting existing users.
✏️ Want to contribute to this wiki?
Update the source and send a PR.