-
Notifications
You must be signed in to change notification settings - Fork 200
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
version 1.7 doesn't work with gopls - "failed to get workspace configuration from client" #587
Comments
I'm using the latest Eglot with
Works fine with Emacs 27.1. Here's an example log of events: [client-request] (id:1) Sat Jan 9 12:22:28 2021:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
(:processId 58188 :rootPath "...elided..." :rootUri "file:///...also-elided..." :initializationOptions #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
())
:capabilities
(:workspace
(:applyEdit t :executeCommand
(:dynamicRegistration :json-false)
:workspaceEdit
(:documentChanges :json-false)
:didChangeWatchedFiles
(:dynamicRegistration t)
:symbol
(:dynamicRegistration :json-false)
:configuration t)
:textDocument
(:synchronization
(:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
:completion
(:dynamicRegistration :json-false :completionItem
(:snippetSupport t)
:contextSupport t)
:hover
(:dynamicRegistration :json-false :contentFormat
["markdown" "plaintext"])
:signatureHelp
(:dynamicRegistration :json-false :signatureInformation
(:parameterInformation
(:labelOffsetSupport t)))
:references
(:dynamicRegistration :json-false)
:definition
(:dynamicRegistration :json-false)
:declaration
(:dynamicRegistration :json-false)
:implementation
(:dynamicRegistration :json-false)
:typeDefinition
(:dynamicRegistration :json-false)
:documentSymbol
(:dynamicRegistration :json-false :hierarchicalDocumentSymbolSupport t :symbolKind
(:valueSet
[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26]))
:documentHighlight
(:dynamicRegistration :json-false)
:codeAction
(:dynamicRegistration :json-false :codeActionLiteralSupport
(:codeActionKind
(:valueSet
["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor.rewrite" "source" "source.organizeImports"]))
:isPreferredSupport t)
:formatting
(:dynamicRegistration :json-false)
:rangeFormatting
(:dynamicRegistration :json-false)
:rename
(:dynamicRegistration :json-false)
:publishDiagnostics
(:relatedInformation :json-false))
:experimental #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
()))))
[server-reply] (id:1) Sat Jan 9 12:22:28 2021:
(:jsonrpc "2.0" :result
(:capabilities
(:textDocumentSync
(:openClose t :change 2 :save nil)
:completionProvider
(:triggerCharacters
["."])
:hoverProvider t :signatureHelpProvider
(:triggerCharacters
["(" ","])
:definitionProvider t :typeDefinitionProvider t :implementationProvider t :referencesProvider t :documentHighlightProvider t :documentSymbolProvider t :codeActionProvider
(:codeActionKinds
["quickfix" "refactor.extract" "refactor.rewrite" "source.fixAll" "source.organizeImports"])
:codeLensProvider nil :documentLinkProvider nil :workspaceSymbolProvider t :documentFormattingProvider t :documentOnTypeFormattingProvider
(:firstTriggerCharacter "")
:renameProvider t :foldingRangeProvider t :executeCommandProvider
(:commands
["gopls.generate" "gopls.fill_struct" "gopls.regenerate_cgo" "gopls.test" "gopls.tidy" "gopls.undeclared_name" "gopls.add_dependency" "gopls.upgrade_dependency" "gopls.remove_dependency" "gopls.vendor" "gopls.extract_variable" "gopls.extract_function" "gopls.gc_details" "gopls.generate_gopls_mod"])
:callHierarchyProvider t :workspace
(:workspaceFolders
(:supported t :changeNotifications "workspace/didChangeWorkspaceFolders")))
:serverInfo
(:name "gopls" :version "{\"path\":\"golang.org/x/tools/gopls\",\"version\":\"v0.5.5\",\"sum\":\"h1:YBLs2WCwxx6mBF98Y6/mDIpKhP4Dt4Dz2q6LnMRBpDw=\",\"deps\":[{\"path\":\"github.com/BurntSushi/toml\",\"version\":\"v0.3.1\",\"sum\":\"h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=\"},{\"path\":\"github.com/google/go-cmp\",\"version\":\"v0.5.1\",\"sum\":\"h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k=\"},{\"path\":\"github.com/sergi/go-diff\",\"version\":\"v1.1.0\",\"sum\":\"h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=\"},{\"path\":\"golang.org/x/mod\",\"version\":\"v0.3.0\",\"sum\":\"h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=\"},{\"path\":\"golang.org/x/sync\",\"version\":\"v0.0.0-20201020160332-67f06af15bc9\",\"sum\":\"h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=\"},{\"path\":\"golang.org/x/tools\",\"version\":\"v0.0.0-20201204180437-c46b611624b3\",\"sum\":\"h1:uxH+MECLNmX/vsPe4txyeQ1LCmhdUxf7p4hjkHexg+c=\"},{\"path\":\"golang.org/x/xerrors\",\"version\":\"v0.0.0-20200804184101-5ec99f83aff1\",\"sum\":\"h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=\"},{\"path\":\"honnef.co/go/tools\",\"version\":\"v0.0.1-2020.1.6\",\"sum\":\"h1:W18jzjh8mfPez+AwGLxmOImucz/IFjpNlrKVnaj2YVc=\"},{\"path\":\"mvdan.cc/gofumpt\",\"version\":\"v0.0.0-20200927160801-5bfeb2e70dd6\",\"sum\":\"h1:z+/YqapuV7VZPvBb3GYmuEJbA88M3PFUxaHilHYVCpQ=\"},{\"path\":\"mvdan.cc/xurls/v2\",\"version\":\"v2.2.0\",\"sum\":\"h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=\"}]}"))
:id 1)
[client-notification] Sat Jan 9 12:22:28 2021:
(:jsonrpc "2.0" :method "initialized" :params #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data
()))
[client-notification] Sat Jan 9 12:22:28 2021:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
(:textDocument
(:uri "file:///...also-elided...main.go" :version 0 :languageId "go" :text "...elided...")))
[client-notification] Sat Jan 9 12:22:28 2021:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
(:textDocument
(:uri "file:///...also-elided...service/response.go" :version 0 :languageId "go" :text "...elided...")))
[client-notification] Sat Jan 9 12:22:28 2021:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
(:textDocument
(:uri "file:///...also-elided...service/games.go" :version 0 :languageId "go" :text "...elided...")))
[client-notification] Sat Jan 9 12:22:28 2021:
(:jsonrpc "2.0" :method "textDocument/didOpen" :params
(:textDocument
(:uri "file:///...also-elided...service/service.go" :version 0 :languageId "go" :text "...elided...")))
[client-notification] Sat Jan 9 12:22:28 2021:
(:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params
(:settings nil))
[server-notification] Sat Jan 9 12:22:28 2021:
(:jsonrpc "2.0" :method "window/showMessage" :params
(:type 4 :message "Loading packages..."))
[server-request] (id:1) Sat Jan 9 12:22:28 2021:
(:jsonrpc "2.0" :method "workspace/configuration" :params
(:items
[(:scopeUri "file:///...also-elided..." :section "gopls")])
:id 1)
[client-reply] (id:1) Sat Jan 9 12:22:28 2021:
(:jsonrpc "2.0" :id 1 :result
[nil])
[server-request] (id:2) Sat Jan 9 12:22:28 2021:
(:jsonrpc "2.0" :method "client/registerCapability" :params
(:registrations
[(:id "workspace/didChangeWatchedFiles-0" :method "workspace/didChangeWatchedFiles" :registerOptions
(:watchers
[(:globPattern "**/*.{go,mod,sum}" :kind 7)]))])
:id 2)
[client-reply] (id:2) Sat Jan 9 12:22:28 2021:
(:jsonrpc "2.0" :id 2 :result nil)
[server-notification] Sat Jan 9 12:22:28 2021:
(:jsonrpc "2.0" :method "window/logMessage" :params
(:type 3 :message "2021/01/09 12:22:28 go env for /...also-elided...\n(root ...also-elided...)\n(go version go version go1.15.6 linux/amd64)\n(valid build configuration = true)\n(build flags: [])\nGOMOD=/...also-elided...go.mod\nGONOPROXY=\nGOPATH=/home/capitaomorte/.golang\nGOPRIVATE=\nGOROOT=/opt/go\nGO111MODULE=\nGOINSECURE=\nGOMODCACHE=/home/capitaomorte/.golang/pkg/mod\nGONOSUMDB=\nGOSUMDB=sum.golang.org\nGOCACHE=/home/capitaomorte/.cache/go-build\nGOPROXY=https://proxy.golang.org,direct\nGOFLAGS=\n\n"))
[server-notification] Sat Jan 9 12:22:28 2021:
(:jsonrpc "2.0" :method "window/logMessage" :params
(:type 3 :message "2021/01/09 12:22:28 go/packages.Load\n snapshot=0\n directory=...also-elided...\n query=[builtin ...also-elided.../...]\n packages=3\n"))
[server-notification] Sat Jan 9 12:22:29 2021:
(:jsonrpc "2.0" :method "window/showMessage" :params
(:type 3 :message "Finished loading packages."))
[server-request] (id:3) Sat Jan 9 12:22:29 2021:
(:jsonrpc "2.0" :method "workspace/configuration" :params
(:items
[(:section "gopls")])
:id 3)
[client-reply] (id:3) Sat Jan 9 12:22:29 2021:
(:jsonrpc "2.0" :id 3 :result
[nil])
[server-request] (id:4) Sat Jan 9 12:22:29 2021:
(:jsonrpc "2.0" :method "workspace/configuration" :params
(:items
[(:scopeUri "file:///...also-elided..." :section "gopls")])
:id 4)
[client-reply] (id:4) Sat Jan 9 12:22:29 2021:
(:jsonrpc "2.0" :id 4 :result
[nil])u |
Thanks for the quick response. It might be a Mac thing (I noticed you use Linux). Can you please share your recommended plain vanilla eglot config? Any suggestions regarding logging collection from gopls to try to get to the bottom of this issue? Cheers, |
I investigated it some more and it seems that disabling the |
See the README. If it's not clear, it's no configuration. For
It might be, it gives me a hint. What would be even more helpful is if you would share (in a snippet) your entire transcript of Eglot's conversation with your |
I'll be damned if it didn't disappeared... I commented out my change (
|
Eglot is still failing to reply to this server request. I'll have to check this: [server-request] (id:1) Sat Jan 9 19:24:37 2021:
(:jsonrpc "2.0" :method "workspace/configuration" :params
(:items
[(:scopeUri "file:///Users/shmul/PROJECTDIR/" :section "gopls")])
:id 1)
[client-reply] (id:1) ERROR Sat Jan 9 19:24:37 2021: |
Seeing another different type of failed request to the server w/ gopls: [server-request] (id:15) Wed May 18 13:11:50 2022:
(:jsonrpc "2.0" :method "client/registerCapability" :params
(:registrations
[(:id "workspace/didChangeWatchedFiles-1" :method "workspace/didChangeWatchedFiles" :registerOptions
(:watchers
[(:globPattern "{/Users/user/src/github.com/acme/services,/Users/user/src/github.com/acme/core/services/widget,/Users/acme/src/github.com/acme/core/services/widget/test}" :kind 7)
(:globPattern "**/*.{go,mod,sum,work}" :kind 7)]))])
:id 15)
[client-reply] (id:15) ERROR Wed May 18 13:11:50 2022:
(:jsonrpc "2.0" :id 15 :error
(:code -32603 :message "Internal error")) Eglot version |
I'm running into what I think is the same problem, but manifesting as a deadlock instead of an error, using gopls v0.9.4 and eglot built from source at HEAD (commit 000b7fd). The specific pathology seems to be:
At that point, it appears that |
Attached are the raw JSON bytes read and written by
1635-gopls-in.json.txt |
To be clear: I think that both eglot and gopls are behaving incorrectly here. (gopls is incorrectly blocking its response to the I've filed the corresponding gopls bug as golang/go#54559. |
In the interim, I have worked around the bug in a local patch by disabling support for the From f1bc2aca99daaa0ebd23a557f6bfac81fcb33cc9 Mon Sep 17 00:00:00 2001
From: "Bryan C. Mills" <[email protected]>
Date: Fri, 19 Aug 2022 17:25:42 -0400
Subject: [PATCH] Work around #587: Disable workspace/configuration support to
avoid a gopls deadlock
---
eglot.el | 1 -
1 file changed, 1 deletion(-)
diff --git a/eglot.el b/eglot.el
index 14e7980..c3eda1d 100644
--- a/eglot.el
+++ b/eglot.el
@@ -676,7 +676,6 @@ treated as in `eglot-dbind'."
`(:dynamicRegistration
,(if (eglot--trampish-p s) :json-false t))
:symbol `(:dynamicRegistration :json-false)
- :configuration t
:workspaceFolders t)
:textDocument
(list
--
2.36.1.838.g23b219f8e3 |
I'm running into the same (or similar?) issue as @bcmills. gopls was waiting for a I have a reduced configuration at https://gist.github.com/sirn/510fbd9c15c0f85533fdbb62569200c8 In my case, it worked under gopls v0.9.4 but started failing in gopls v0.9.5, and only when Emacs is running in GUI mode under macOS (both Mitsuharu's EmacsMac.app and mainline Emacs.app). gopls+eglot started working correctly again once I run I initially thought this was a regression with gopls, so I run |
I have lost many hours to this problem, today, too. The triggering condition for me was editing @bcmills Thanks for your patch, the workaround makes the problem go away on my machine, too. @sirn How interesting that you went down a similar rabbit hole as I did. For me, I tried I tried instead using I also tried instead adding So given the weird bisection results, but also the weird system-vs-nix behavior, I’m thinking it’s not the code change itself, but something else about the binary that just happens to be triggered by a code change. I uploaded my eglot logs (broken/working) at https://gist.github.com/stapelberg/7ea441dc5bdef1a795cdd7bcb5b5b4cb in case that’s helpful. In the working log, the |
I think am suffering of this same bug, reported as https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59883 The most proper "workaround" is to have a rather small go-file in the workspace, which imports none or only a handful of small core packages. If that file is opened first, gopls probably responds quickly enough not to fall into the deadlock. Opening larger files afterwards will use a then properly initialized gopls. |
There is some more investigation by the gopls maintainers in golang/go#54559 (comment), saying that it’s tricky to do something about this bug on the gopls side, and a better/easier fix would be on the eglot side. Any chance we can fix this in eglot? |
Sure, as long as you specify exactly what you want me to fix. This issue has become the bucket for anything anyone doesn't find works OK with Eglot + gopls. There seem to be at three different things reported here. Reading your linked comment is a bit surreal. Parts of it make sense, but others are odd. Eglot doesn't request |
Is #587 (comment) not specific enough? Which extra information would you like me to gather? |
No @stapelberg it is not. It is a hint that something is not working for you. It's fine to give these hints, but if there is something to fix and you want me to put in hours of my effort to do it, then you (or someone else) have to put in some work to make a reproducible error recipe. Something that guarantees that, given enough hours of installing language servers and setting up stuff, I will be able to witness the error in my machine, in front of me. Without this guarantee, I will generally not start to work on a "fix", unless I'm pretty confident I see the problem already. And I don't. So please read https://joaotavora.github.io/eglot/#Troubleshooting-Eglot and DO NOT skip any steps. I've also commented in the Gopls issue. |
Okay, I’ll try and follow the troubleshooting page over the coming days. |
Over at that bug I have reproduced the reported problem, which seems to be one of the problems reported here. I provided a provisional fix there, for those very eager to try it out. The problem, according to my analysis, is not on the gopls side, but on the Emacs/Eglot side. I will file an emacs bug report soon for that specific identified problem. |
Filed Emacs bug: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60088 |
Hi,
With the upgrade to 1.7 eglot stopped working with gopls (I tried a couple of versions and they all behaved the same; now I'm at 0.6.2). I switched to
lsp-mode
( :( ) and it works fine. I'm using Mac Big Sur, though the problems were there with previous OS version as well. Emacs version is 27.1 .I'll be happy to provide additional information if needed.
Cheers,
Shmul
The text was updated successfully, but these errors were encountered: