What version of Go, VS Code & VS Code Go extension are you using?
Version Information
-
Run go version to get version of Go from the VS Code integrated terminal.
- go version go1.26.3 linux/amd64
-
Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
- golang.org/x/tools/gopls v0.22.0, built with go: go1.26.3
-
Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
- 1.121.0 (f6cfa2ea2403534de03f069bdf160d06451ed282) x64
-
Check your installed extensions to get the version of the VS Code Go extension
-
Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
Go: Locate Configured Go Tools output
# Tools Configuration
## Environment
GOBIN: undefined
toolsGopath:
gopath: /home/gmarsano/go
GOROOT: /usr/local/go
PATH: /home/gmarsano/.config/composer/vendor/bin:/home/gmarsano/.local/bin:/home/gmarsano/.nvm/versions/node/v24.11.1/bin:/home/gmarsano/.config/composer/vendor/bin:/home/gmarsano/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/home/gmarsano/go/bin:/usr/local/go/bin:/home/gmarsano/go/bin
## Tools
go: /usr/local/go/bin/go: go version go1.26.3 linux/amd64
gotests: /home/gmarsano/go/bin/gotests (version: v1.6.0 built with go: go1.26.3)
impl: /home/gmarsano/go/bin/impl (version: v1.4.0 built with go: go1.26.3)
goplay: /home/gmarsano/go/bin/goplay (version: v1.0.0 built with go: go1.26.3)
dlv: /home/gmarsano/go/bin/dlv (version: v1.26.3 built with go: go1.26.3)
gopls: /home/gmarsano/go/bin/gopls (version: v0.22.0 built with go: go1.26.3)
Share the Go related settings you have added/edited
"gopls": {
"ui.semanticTokens": true
},
"[go]": {
"editor.defaultFormatter": "golang.go"
},
"go.toolsManagement.autoUpdate": true
Describe the bug
editor.action.commentLine does not work on .go files. Whether triggered via keyboard shortcut or the Command Palette, the command is dispatched (confirmed with Developer: Toggle Keyboard Shortcuts Troubleshooting) but has no effect — lines are neither commented nor uncommented.
The issue appears to be exclusive to Go files managed by the vscode-go extension. The same command works correctly on other file types (e.g. JavaScript, Python).
Expected behavior: The current line (or selected lines) should be toggled between commented and uncommented using //.
Steps to reproduce the behavior:
- Open any
.go file in VS Code.
- Place the cursor on a line with code (or select multiple lines).
- Trigger
editor.action.commentLine via its keyboard shortcut or via the Command Palette (Toggle Line Comment).
- Observe that nothing happens — no comment is added or removed.
To confirm the command is reaching VS Code: enable Developer: Toggle Keyboard Shortcuts Troubleshooting, trigger the shortcut, and check the Output panel. The command appears in the log but produces no visible result.
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
Run
go versionto get version of Go from the VS Code integrated terminal.Run
gopls -v versionto get version of Gopls from the VS Code integrated terminal.Run
code -vorcode-insiders -vto get version of VS Code or VS Code Insiders.Check your installed extensions to get the version of the VS Code Go extension
Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) >
Go: Locate Configured Go Toolscommand.Go: Locate Configured Go Tools output
Share the Go related settings you have added/edited
Describe the bug
editor.action.commentLinedoes not work on.gofiles. Whether triggered via keyboard shortcut or the Command Palette, the command is dispatched (confirmed withDeveloper: Toggle Keyboard Shortcuts Troubleshooting) but has no effect — lines are neither commented nor uncommented.The issue appears to be exclusive to Go files managed by the vscode-go extension. The same command works correctly on other file types (e.g. JavaScript, Python).
Expected behavior: The current line (or selected lines) should be toggled between commented and uncommented using
//.Steps to reproduce the behavior:
.gofile in VS Code.editor.action.commentLinevia its keyboard shortcut or via the Command Palette (Toggle Line Comment).To confirm the command is reaching VS Code: enable
Developer: Toggle Keyboard Shortcuts Troubleshooting, trigger the shortcut, and check the Output panel. The command appears in the log but produces no visible result.