个人博客地址:https://congz666.gitee.io/
VSCode设置gopl
安装
打开 VS Code 的设置, 搜索 go.useLanguageServe
, 并勾选上.
默认情况下, Go 扩展会提示你安装 gopls.
如果长时间安装不上, 可以尝试手动安装,
官方安装指南.
配置
在settings.json里配置
装完之后, 添加如下的配置, 如果使用第一种安装方式, 那么第一行已经存在了:
"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
"wantCompletionDocumentation": true // for documentation in completion items
},
"files.eol": "\n", // formatting only supports LF line endings