在VS Code Go扩展中默认打开gopls

Gopls on by default in the VS Code Go extension - 在VS Code Go扩展中默认打开gopls

https://go.dev/blog/gopls-vscode-go

Go tools team 1 February 2021

We’re happy to announce that the VS Code Go extension now enables the gopls language server by default, to deliver more robust IDE features and better support for Go modules.

​ 我们很高兴地宣布,VS Code Go扩展现在默认启用 gopls 语言服务器,以提供更强大的IDE功能和对Go模块的更好支持。

img

(gopls provides IDE features, such as intelligent autocompletion, signature help, refactoring, and workspace symbol search.)

(gopls提供IDE功能,如智能自动完成、签名帮助、重构和工作区符号搜索)。

When Go modules were released two years ago, they completely changed the landscape of Go developer tooling. Tools like goimports and godef previously depended on the fact that code was stored in your $GOPATH. When the Go team began rewriting these tools to work with modules, we immediately realized that we needed a more systematic approach to bridge the gap.

​ 当Go modules在两年前发布时,它们完全改变了Go开发工具的面貌。像goimportsgodef这样的工具以前依赖于代码存储在$GOPATH中的事实。当 Go 团队开始重写这些工具以便与模块一起工作时,我们立即意识到我们需要一种更系统的方法来弥补这一差距。

As a result, we began working on a single Go language server, gopls, which provides IDE features, such as autocompletion, formatting, and diagnostics to any compatible editor frontend. This persistent and unified server is a fundamental shift from the earlier collections of command-line tools.

​ 因此,我们开始着手开发一个单一的Go语言服务器gopls,它为任何兼容的编辑器前端提供IDE功能,如自动完成、格式化和诊断功能。这种持久而统一的服务器是对早期的命令行工具集合的根本性转变

In addition to working on gopls, we sought other ways of creating a stable ecosystem of editor tooling. Last year, the Go team took responsibility for the Go extension for VS Code. As part of this work, we smoothed the extension’s integration with the language server—automating gopls updates, rearranging and clarifying gopls settings, improving the troubleshooting workflow, and soliciting feedback through a survey. We’ve also continued to foster a community of active users and contributors who have helped us improve the stability, performance, and user experience of the Go extension.

​ 除了在gopls上的工作,我们还寻求其他方法来创建一个稳定的编辑器工具的生态系统。去年,Go团队负责了VS Code的Go扩展。作为这项工作的一部分,我们平滑了扩展与语言服务器的整合 —— 自动更新gopls,重新安排和明确gopls的设置,改进故障排除工作流程,并通过调查征求反馈意见。我们还继续培养了一个活跃的用户和贡献者社区,他们帮助我们提高了Go扩展的稳定性、性能和用户体验。

Announcement 公告

January 28 marked a major milestone in both the gopls and VS Code Go journeys, as gopls is now enabled by default in the Go extension for VS Code.

​ 1月28日是gopls和VS Code Go旅程中的一个重要里程碑,因为现在VS Code的Go扩展中默认启用了gopls

In advance of this switch we spent a long time iterating on the design, feature set, and user experience of gopls, focusing on improving performance and stability. For more than a year, gopls has been the default in most plugins for Vim, Emacs, and other editors. We’ve had 24 gopls releases, and we’re incredibly grateful to our users for consistently providing feedback and reporting issues on each and every one.

​ 在这次转换之前,我们花了很长时间对gopls的设计、功能设置和用户体验进行了迭代,重点是提高性能和稳定性。一年多来,gopls一直是Vim、Emacs和其他编辑器的大多数插件中的默认配置。我们已经发布了24个gopls版本,我们非常感谢我们的用户不断地提供反馈和报告每一个版本的问题。

We’ve also dedicated time to smoothing the new user experience. We hope that VS Code Go with gopls will be intuitive with clear error messages, but if you have a question or need to adjust some configuration, you’ll be able to find answers in our updated documentation. We have also recorded a screencast to help you get started, as well as animations to show off some hard-to-find features.

​ 我们也花了很多时间来使新的用户体验更加顺畅。我们希望使用gopls的VS Code Go能有直观的错误信息,但如果您有问题或需要调整一些配置,您可以在我们更新的文档中找到答案。我们还录制了一个截屏来帮助您入门,还有动画来展示一些难以发现的功能。

Gopls is the best way of working with Go code, especially with Go modules. With the upcoming arrival of Go 1.16, in which modules are enabled by default, VS Code Go users will have the best possible experience out-of-the-box.

​ Gopls是处理Go代码的最佳方式,尤其是处理Go模块。随着Go 1.16的即将到来,其中的模块是默认启用的,VS Code Go用户将拥有开箱即用的最佳体验。

Still, this switch does not mean that gopls is complete. We will continue working on bug fixes, new features, and general stability. Our next area of focus will be improving the user experience when working with multiple modules. Feedback from our larger user base will help inform our next steps.

​ 不过,这种转换并不意味着gopls已经完成。我们将继续致力于错误修复、新功能和总体稳定性。我们的下一个重点领域将是改善使用多个模块时的用户体验。来自我们广大用户的反馈将有助于我们采取下一步行动。

So, what should you do? 那么,您应该怎么做?

If you use VS Code, you don’t need to do anything. When you get the next VS Code Go update, gopls will be enabled automatically.

​ 如果您使用VS Code,您不需要做任何事情。当您得到下一个VS Code Go更新时,gopls将自动启用。

If you use another editor, you are likely using gopls already. If not, see the gopls user guide to learn how to enable gopls in your preferred editor. The Language Server Protocol ensures that gopls will continue to offer the same features to every editor.

​ 如果您使用其他编辑器,您可能已经在使用gopls了。如果没有,请参阅gopls 用户指南,了解如何在您喜欢的编辑器中启用gopls。语言服务器协议确保gopls将继续为每个编辑器提供相同的功能。

If gopls is not working for you, please see our detailed troubleshooting guide and file an issue. If you need to, you can always disable gopls in VS Code.

​ 如果gopls不能为您工作,请看我们详细的故障排除指南并提出问题。如果您需要,您可以随时在VS Code中禁用gopls

Thank you 谢谢您

To our existing users, thank you for bearing with us as we rewrote our caching layer for the third time. To our new users, we look forward to hearing your experience reports and feedback.

​ 对于我们的现有用户,感谢您们在我们第三次重写缓存层时的支持。对于我们的新用户,我们期待着听到您们的体验报告和反馈。

Finally, no discussion of Go tooling is complete without mentioning the valuable contributions of the Go tools community. Thank you for the lengthy discussions, detailed bug reports, integration tests, and most importantly, thank you for the fantastic contributions. The most exciting gopls features come from our passionate open-source contributors, and we are appreciative of your hard work and dedication.

​ 最后,如果不提及Go工具社区的宝贵贡献,关于Go工具的讨论就不完整。感谢您们长时间的讨论、详细的错误报告、集成测试,最重要的是,感谢您们的精彩贡献。最激动人心的gopls功能来自于我们热情的开源贡献者,我们对您们的辛勤工作和奉献表示感谢。

Learn more 了解更多

Watch the screencast for a walk-through of how to get started with gopls and VS Code Go, and see the VS Code Go README for additional information.

​ 观看截屏视频,了解如何开始使用gopls和VS Code Go,并查看VS Code Go的README,了解更多信息。

If you’d like to read about gopls in more detail, see the gopls README.

​ 如果您想更详细地了解gopls,请看gopls README