dominikh / go-mode.el

Emacs mode for the Go programming language
BSD 3-Clause "New" or "Revised" License
1.37k stars 209 forks source link

When using go-mode eglot failes to properly connect with gopls #413

Closed the42 closed 9 months ago

the42 commented 1 year ago

Using emacs 29 on windows from https://github.com/kiennq/emacs-build/releases/tag/v29.169.20221201.4a23421

When using go-mode eglot failes to properly connect with gopls

The actual error message I get is

Error in menu-bar-update-hook (imenu-update-menubar): (jsonrpc-error "request id=2 failed:" (jsonrpc-error-message . "Timed out")

I already commented out imenu-integration of go-mode, that's not the problem.

The problem is rather hard to debug. In my particular project, out of 20? times gopls and eglot start to interact properly If I open a very small project (so that gopls has probably not much to analyse) go-mode, eglot and gopls always work.

Maybe it is a problem with windows pre-maturely reporting back successful process spawning, maybe it is gopls pre-maturely returning control to the os while rpc thread is still blocked? It seems a rather interacted timing issue of which go-mode may actually not be the culprit but rather a promoter.

Reporting here nonetheless as without go-mode eglot and gopls work.

dominikh commented 1 year ago

Possibly related: https://github.com/joaotavora/eglot/issues/587 and https://github.com/golang/go/issues/54559

the42 commented 1 year ago

Indeed, the fix is to use Emacs 30 OR install jsonrp.el https://elpa.gnu.org/packages/jsonrpc.html

Unrelated to go-mode

the42 commented 9 months ago

Closing this issue as it has been fixed by shipping a more current jsonrpc package in stock emacs 29