-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Share gopls instance with ycm #2421
Comments
I don't know of anyway to do this. |
I found a trick to share the gopls server with all other editor instances, not only with ycm.
mv $GOPATH/bin/gopls{,-server}
mv your_YouCompleteMe_DIR/third_party/ycmd/third_party/go/src/golang.org/x/tools/cmd/gopls/gopls{,.bak}
echo '#!/bin/sh
nc localhost 9877 # or socat - tcp:localhost:9877' > $GOPATH/bin/gopls
cp $GOPATH/bin/gopls your_YouCompleteMe_DIR/third_party/ycmd/third_party/go/src/golang.org/x/tools/cmd/gopls/gopls
chmod a+x $GOPATH/bin/gopls
chmod a+x your_YouCompleteMe_DIR/third_party/ycmd/third_party/go/src/golang.org/x/tools/cmd/gopls/gopls
gopls-server serve -listen "localhost:9877" -logfile /tmp/gopls_$RANDOM.log
There is a problem with ycm: it will send the exit notification to the gopls-server when it is closed. I just comment the code related to this exit: def Exit():
# return BuildNotification( 'exit', None )
pass I hope they can provide a config to avoid exit the gopls-server. |
@stamblerre can you weigh in regarding whether the technique that @hmgle suggests is supported by |
As @thomasfaingnaert mentioned prabirshrestha/vim-lsp#469 (comment), we can start the gopls server outside of Vim, and use |
@hmgle there are more concerns here than simply whether or not the technique is theoretically possible. Also, despite the comments on prabirshrestha/vim-lsp#469 (comment), dealing with stdio on Windows is handled by Vim pretty well. I'd suggest waiting until you experience real problems with multiple gopls instances running before recommending hacks to avoid multiple instances. |
I would not recommend doing this, as we do ultimately intend to support this in |
I use ycm for go. And I also use vim-go. But each of them create a
gopls
instance. Is there any way to sharegopls
instance with ycm.The text was updated successfully, but these errors were encountered: