1、设置“useCodeSnippetsOnFunctionSuggest”,【User】和【Workspace】选项都要设置
2、设置“Use Language Server”,【User】和【Workspace】选项都要设置
3、如果以上两种方式,还不能解决话,参考以下链接:
https://github.com/Microsoft/vscode-go/wiki/GOPATH-in-the-VS-Code-Go-extension
修改workspace Setting里面的配置,例如:
{
"window.zoomLevel": 1,
"go.autocompleteUnimportedPackages": true,
"go.gocodePackageLookupMode": "go",
"go.gotoSymbol.includeImports": true,
"go.useCodeSnippetsOnFunctionSuggest": true,
"go.inferGopath": true,
"go.gopath":"/usr/local/bin/gopath/",
"go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
}
主要是以下两项:
- "go.inferGopath" :true .
- "go.gopath" 的路径要设置为自己服务器环境中的gopath的路径。 如果有多个要用 “;”(windows)或者":"(其他)隔开。