is there a way to autocomplete code when editing go lang code in third package with visual studio code?

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

is there a way to autocomplete code when editing go lang code in third package with visual studio code?

问题

主包中的自动补全功能正常工作。

在主包中工作

当跳转到第三个包时,自动补全无法正常工作。

在第三个包中无法工作

bigxu@T ~> gopls version

golang.org/x/tools/gopls v0.7.0

bigxu@T ~> code --version

1.57.1

英文:

autocomplete working fine in main package .

working in main package

autocomplete can not work rightly when jumping into the third package

can not work in third package

bigxu@T ~> gopls version

golang.org/x/tools/gopls v0.7.0

bigxu@T ~> code --version

1.57.1

答案1

得分: 1

是的。

在使用 gopls 进行 IDE 集成时(这是 VsCode Go 扩展现在推荐的方式,所以我假设你正在使用这个方式),你需要将你打算进行更改的相关项目在同一个工作区中打开。如果在不同的 VsCode 实例中打开它们,会导致由于语言服务器的运行方式而出现问题。

英文:

> is there a way to autocomplete code when editing go lang code in third package with visual studio code?

Yes.

When using gopls for IDE integration (which is by now recommended by the VsCode Go Extension so I'll assume that's what you are using) you need to have related projects which you intend to make changes to opened within the same, single workspace in VsCode. Opening them in seperate instances of VsCode will cause issues due to the way the language server operates.

huangapple
  • 本文由 发表于 2021年6月24日 23:59:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/68119124.html
匿名

发表评论

匿名网友

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

确定