the biggest application of language server (gopls) is for the IDE: vscode or vim/neovim. automatic gopls management is the right direction for those IDE. people always want simple and good thing. for vim-go or coc-go, manually manage the language server will not be easy, it's even harder for other developers to use it. a lot of post on the github already prove that.
I absolutely support the automatic daemon management. while keep the manually management available for some rare cases.
i am not very familiar with the gopls code. after investigated the vim-go, coc-go and coc.nvim for some time. i turned to gopls. it took me several days to understand the daemon related code. If i am familiar with the gopls code, a PR will appear.
there is indeed an improvement I will propose:- when edit a file, such as internal/lsp/lsprpc/lsprpc.go ,
- you see a statement in line 289, "func connectToRemote":
"network, address = autoNetworkAddress(goplsPath, inAddr)",
now, to find the autoNetworkAddress func, you send a 'definition' query to the gopls server. - in current implementation, 'definition' query will return the internal/lsp/lsprpc/autostart_default.go result. and the editor jump to that file without any choice. this implementation will mislead the developer. i checked the code several times and finally notice the 'build tags'
- the propose is to return the internal/lsp/lsprpc/autostart_posix.go , the behavior of 'definition' query should consider the 'build tags', in this case, it is "// +build darwin dragonfly freebsd linux netbsd openbsd solaris".
if you think my propose is needed. i will file an issue. maybe a PR will appear.
qi wang