gopls——及时的代码补全

#Golang #VSCode

升级Go1.12之后虽然可以使用go mod在GOPATH之外构建工程,同时却带来了诸多开发工具兼容性问题 这里无意介绍有关包管理的使用,对我而言,最头疼的是VSCode自动补全基本残废,自动提示已经追 不上我的输入了( ﹁ ﹁ ) ~→ 网上也没有什么解决方法,经过重新编译工具->查看issue->重搭环境之后,决定使用微软力推的lsp 总之就是启用useLanguageServer,需要预先编译gopls,然后启用ExperimentalFeatures,关闭server Format,为了支持格式化,设置defaultFormatter,超快的代码提示又回来啦( ̄▽ ̄)" 贴一下我的配置 ``` { "files.autoSave": "afterDelay", "go.goroot": "C:/Go", "go.gopath": "C:/Code/MyGoWorks", "go.useLanguageServer": true, "go.languageServerExperimentalFeatures": { "format": false, "autoComplete": true, "rename": true, "goToDefinition": true, "hover": true, "signatureHelp": true, "goToTypeDefinition": true, "goToImplementation": true, "documentSymbols": true, "workspaceSymbols": true, "findReferences": true, "diagnostics": false }, "http.proxy": "http://127.0.0.1:1080", "[go]": { "editor.defaultFormatter": "ms-vscode.Go" }, } ``` PS. 看到bingo作者的声明,一时些许感慨 > I am very sorry that I have planned not continue to maintain this project. > > According to the issue #13 collaborating on golsp, I hope that we will eventually have a unified language server: gopls. > > It is Google's upcoming Go language server. It is in the best interests of the community to only have a single language server.

上一篇