vscode 用 gopls : is the official language server for the Go language
vscode 设置参考:
vscode-gopls 设置
注意: 打开一个项目,不能打开多个项目。即打开有go.mod的目录 ,否则不能跳转,甚至有错误提示。
{
"go.useLanguageServer": true,
"[go]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true,
},
// Optional: Disable snippets, as they conflict with completion ranking.
"editor.snippetSuggestions": "none",
},
"[go.mod]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true,
},
},
"gopls": {
// Add parameter placeholders when completing a function.
"usePlaceholders": true,
// If true, enable additional analyses with staticcheck.
// Warning: This will significantly increase memory usage.
"staticcheck": false,
},
//个人喜欢
"go.docsTool": "gogetdoc"
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 500,
"editor.fontSize": 16,
}