iTranslated by AI
Atom Editor Now Supports gopls
I believe the greatest achievement of Microsoft's Visual Studio Code is the creation of the "Language Server Protocol (LSP)."
This made it possible to decouple features that assist coding—such as auto-completion, code formatting, and jump-to-definition—from specific language and editor implementations. Tool developers can now focus on creating language server applications that conform to this protocol.
Various programming language communities provide their own language servers. In the Go community, several implementations existed from an early stage, but now it seems they are converging towards Google's gopls (apparently pronounced "go please" 😄). Although gopls itself is said to be still in alpha, it is already being used not only in VSCode but also in Vim, Emacs, and others.
The one remarkably left behind in this trend is the ATOM editor. The reason is that go-plus, the leading package for Go support, still uses gocode. In fact, development of go-plus has essentially stopped about two years ago. The fact that no package has yet surpassed go-plus might be circumstantial evidence of how deserted the ATOM editor has become (from a Go programmer's perspective)[1].
(I really wonder what GitHub plans to do with ATOM)
Well, it seems it hasn't been completely abandoned; gopls apparently recommends ide-gopls as an ATOM package.
The features of ide-gopls are as follows:
- Auto completion
- Code format
- Diagnostics (errors & warnings)
- Document outline
- Find references
- Go to definition
- Hover
- Reference highlighting
I had a quick chance to try it out, and here are my impressions:
- Because the user interface is integrated into atom-ide-ui, the auto-completion is very well executed.
- Code formatting only supports up to the gofmt level. I wished it supported at least the goimports level (this might be an issue on the gopls side).
- It lacks features like Lint, test, and coverage. Well, you can just run commands from x-terminal, but it's satisfying when lint and tests run the moment you save, isn't it? 😄
Since the comparison is against go-plus, please excuse the somewhat harsh evaluation. I suppose it's a matter of "high expectations for the future." gocode has already reached the end of its life as software, so if you can't stand the auto-completion in go-plus, supporting and growing ide-gopls might be a good path.
As for me, I'll wait until at least lint & test are supported. I'll endure for a little longer.
References
- Big Sky :: Moving away from gocode (and towards Language Server)
- Big Sky :: Go language server "gopls" now supports completeUnimported.
- Trying to initialize a struct ("fillstruct") with gopls 0.4.3 results in "No code actions found" - My External Storage
- Building a Vim development environment for Go using LSP (gopls) without vim-go - My External Storage
-
By the way, gocode does not work properly on Windows 10 even if you download and compile it with a standard
go get. To make it work, you need to add the-ldflags -H=windowsguiflag during compilation, but go-plus completely ignores this and performs a standardgo getto overwrite the installation, so there's no way around it. ↩︎
Discussion