How can I use "gocode" to autocomplete code and use "gopls" ust for code navigation when I use Vscode

huangapple go评论78阅读模式
英文:

How can I use "gocode" to autocomplete code and use "gopls" ust for code navigation when I use Vscode

问题

我的公司项目有很多代码。由"gopls"提供的自动补全功能有大约1秒的延迟,这让我有点不满意。

然后我发现gocode的自动补全速度更快。

但是当我打开"gopls"时,"gocode"就无法工作了。
而且如果我关闭"gopls",就无法使用"gopls"提供的导航功能。

英文:

My company's project has so mush code.The autocomplete provided by "gopls" has a delay for about 1 second.
That was a little upset for me.

Then I find that gocode's autocomplete is faster.

But when I turn on "gopls", "gocode" won't work.
And if I turn off "gopls", I can't have the navigation provided by the "gopls".

答案1

得分: 1

如在nfs/gocode README中提到:

> 非常重要:该项目不再维护,请寻找替代方案或分支,如果您需要Go自动完成工具。

mdempsky/gocode README中:

> 为了获得更好的Go自动完成体验,我们建议您使用Go语言服务器gopls

因此,请首先检查是否实际上需要所有公司代码来编译您的项目。
也许您可以使用sparse-checkout来获取所需的代码部分,而不是获取全部代码。
并确保您的模块都是必需的,使用go mod tidy命令。

英文:

As mentioned in the

> VERY IMPORTANT: this project is not maintained anymore, look for alternatives or forks if you need Go autocompletion tool

> For a better autocompletion experience with Go, we suggest you use the Go language server, gopls.

So do check first if all the company code is actually needed to compile your project.
Maybe you could do some sparse-checkout in order to not get all the code, but only the part you need.
And make sure your modules are all needed, using go mod tidy.

huangapple
  • 本文由 发表于 2021年10月15日 13:17:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/69580271.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定