Vim-go: go_gopls_options usage

Created on 3 Apr 2020  Â·  7Comments  Â·  Source: fatih/vim-go

In your documentation you say:

'g:go_gopls_options' can be used to configure
how vim-go starts gopls so that the instance can be shared with other
plugins and vim-go user's can leverage the full power of vim-go.

I want to do this since I use coc.nvim. So I looked up the gopls docs to figure out how to do this but their documentation for command line flags is empty

I would greatly appreciate it if you could provide an example of how to do this, thanks.

Most helpful comment

@nwaywood See this issue which might help.

All 7 comments

You can use gopls -h at the command line to see the options available.

I use let g:go_gopls_options = ['-remote=auto']. You'll have to check with coc.nvim to understand how to configure it to also use a shared instance.

https://github.com/golang/go/issues/33030#issuecomment-582063229 documents that there's support for multiple concurrent clients now and links to https://github.com/golang/go/issues/34111 for information about that feature.

@bhcleek Thanks for the reply.

I assume many people will be in this situation using something like coc.nvim for lsp support in other languages. Is this the recommended way to do this? Or is it recommend to just disable coc.nvim for golang?

It's not an either-or situation; do what works for you. Sharing the gopls instance is an efficiency, but not required. coc.nvim and vim-go each use gopls.

For anyone who comes across this issue. Unfortunately I was not able to get the -remote=auto thing to work. So I just disabled gopls in vim-go and am using gopls from coc.nvim.

If seems to be working fine, however note that I only really use the language server for go to definition, autocomplete and go to buffer symbol

@nwaywood See this issue which might help.

@ygworldr subscribed to the issue. Thank you :)

@nwaywood Not sure if it will help but we can but hope. ☺

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andrejvanderzee picture andrejvanderzee  Â·  3Comments

johnzeng picture johnzeng  Â·  3Comments

surest picture surest  Â·  3Comments

svanharmelen picture svanharmelen  Â·  3Comments

preslavmihaylov picture preslavmihaylov  Â·  3Comments