在新VSCode 1.52.1
版本中,我已经安装了 Go 扩展Go Team at Google v0.19.1
以及建议的 go 包,但是保存时的自动格式无法正常工作。
go version go1.14.6 linux/amd64
在 settings.json 我有
{
"go.addTags": {
"template": "tmpl"
},
"go.autocompleteUnimportedPackages": true,
"editor.formatOnSave": true,
"go.formatTool": "gofmt",
"emmet.preferences": {
},
"go.useLanguageServer": true,
"go.overwriteGoplsMiddleware": {
}
}
我以前在另一个 vscode 编辑器上曾经有一个很好的自动格式化 ( goftm
) 效果,但我无法访问那台机器,我不记得那里的确切扩展名在哪里。所以我不确定这里缺少什么,并感谢您的提示。