zed
zed copied to clipboard
Go language server not working when opening zed with a folder pre-opened
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
When opening a project with go files (the folder opens automatically when opening zed), apparently the lsp stops working and its showing an error at the package line: "No active builds contain /Users/joyzyy/Documents/test_projects/zeromq_go/routes.go: consider opening a new workspace folder containing it". Other text editors dont have this problem, and when opening the same folder with command+o, the issue fixes itself.
Seems somewhat tied with issue #6088
Environment
Zed: v0.125.1 (Zed Preview) OS: macOS 14.1.1 Memory: 8 GiB Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.
If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.
2024-03-03T16:34:03+02:00 [INFO] set environment variables from shell:/bin/zsh, path:/opt/homebrew/opt/libpq/bin:/opt/homebrew/opt/gradle@7/bin:/opt/homebrew/opt/openjdk@11/bin:/opt/homebrew/opt/gradle@7/bin:/Users/joyzyy/.meteor:/Users/joyzyy/.nvm/versions/node/v14.21.3/bin:/Users/joyzyy/.bun/bin:/opt/homebrew/opt/openjdk/bin:/Users/joyzyy/Library/Python/3.9/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:~/.dotnet/tools:/Users/joyzyy/.cargo/bin:/Users/joyzyy/Library/Application Support/JetBrains/Toolbox/scripts:/Users/joyzyy/.dotnet/tools:/Users/joyzyy/Library/Android/sdk/emulator:/Users/joyzyy/Library/Android/sdk/tools:/Users/joyzyy/Library/Android/sdk/platform-tools:/Users/joyzyy/Library/Android/sdk/build-tools/33.0.1:/Users/joyzyy/Library/Android/sdk/cmdline-tools/8.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:~/.dotnet/tools:/Users/joyzyy/.cargo/bin:/Users/joyzyy/Library/Application Support/JetBrains/Toolbox/scripts:/Users/joyzyy/.dotnet/tools:/Users/joyzyy/Library/Android/sdk/emulator:/Users/joyzyy/Library/Android/sdk/tools:/Users/joyzyy/Library/Android/sdk/platform-tools:/Users/joyzyy/Library/Android/sdk/build-tools/33.0.1:/bin:/Users/joyzyy/go/bin:/Users/joyzyy/flutter/bin 2024-03-03T16:34:03+02:00 [INFO] found user-installed language server for Go. path: "/Users/joyzyy/go/bin/gopls", arguments: ["-mode=stdio"] 2024-03-03T16:34:03+02:00 [INFO] starting language server. binary path: "/Users/joyzyy/go/bin/gopls", working directory: "/Users/joyzyy/Documents/test_projects/zeromq_go", args: ["-mode=stdio"] 2024-03-03T16:34:03+02:00 [INFO] starting language server. binary path: "/Users/joyzyy/Library/Application Support/Zed/node/node-v18.15.0-darwin-arm64/bin/node", working directory: "/", args: ["/Users/joyzyy/Library/Application Support/Zed/copilot/copilot-v0.5.0/dist/agent.js", "--stdio"] 2024-03-03T16:34:03+02:00 [INFO] Language server with id 1 sent unhandled notification window/showMessage: { "type": 1, "message": "Error loading workspace folders (expected 1, got 0)\nfailed to load view for file:///Users/joyzyy/Documents/test_projects/zeromq_go: err: go command required, not found: exec: "go": executable file not found in $PATH: stderr: \n" } 2024-03-03T16:34:03+02:00 [INFO] Language server with id 1 sent unhandled notification window/showMessage: { "type": 1, "message": "Error loading workspace folders (expected 1, got 0)\nfailed to load view for file:///Users/joyzyy/Documents/test_projects/zeromq_go: err: go command required, not found: exec: "go": executable file not found in $PATH: stderr: \n" } 2024-03-03T16:34:03+02:00 [INFO] Language server with id 1 sent unhandled notification window/showMessage: { "type": 1, "message": "Error loading workspace folders (expected 1, got 0)\nfailed to load view for file:///Users/joyzyy/Documents/test_projects/zeromq_go: err: go command required, not found: exec: "go": executable file not found in $PATH: stderr: \n" } 2024-03-03T16:34:03+02:00 [INFO] Language server with id 1 sent unhandled notification window/showMessage: { "type": 1, "message": "Error loading workspace folders (expected 1, got 0)\nfailed to load view for file:///Users/joyzyy/Documents/test_projects/zeromq_go: err: go command required, not found: exec: "go": executable file not found in $PATH: stderr: \n" } 2024-03-03T16:34:03+02:00 [INFO] add connection to peer 2024-03-03T16:34:03+02:00 [INFO] waiting for server hello 2024-03-03T16:34:03+02:00 [INFO] got server hello 2024-03-03T16:34:03+02:00 [INFO] set status to connected (connection id: ConnectionId { owner_id: 0, id: 0 }, peer id: PeerId { owner_id: 348, id: 1098602 }) 2024-03-03T16:34:03+02:00 [INFO] set status on client 124849: Connected { peer_id: PeerId { owner_id: 348, id: 1098602 }, connection_id: ConnectionId { owner_id: 0, id: 0 } } 2024-03-03T16:34:04+02:00 [INFO] Language server with id 0 sent unhandled notification LogMessage: { "level": 0, "message": "[DEBUG] [agent] [2024-03-03T14:34:04.004Z] Agent service starting", "metadataStr": "[DEBUG] [agent] [2024-03-03T14:34:04.004Z]", "extra": [ "Agent service starting" ] } 2024-03-03T16:34:04+02:00 [INFO] Language server with id 0 sent unhandled notification client/registerCapability: { "registrations": [ { "id": "915f4fad-a80d-4626-bd49-8635bc2a6459", "method": "workspace/didChangeWorkspaceFolders", "registerOptions": {} } ] } 2024-03-03T16:34:04+02:00 [INFO] Language server with id 0 sent unhandled notification LogMessage: { "level": 0, "message": "[DEBUG] [agent] [2024-03-03T14:34:04.430Z] Telemetry initialized", "metadataStr": "[DEBUG] [agent] [2024-03-03T14:34:04.430Z]", "extra": [ "Telemetry initialized" ] } 2024-03-03T16:34:04+02:00 [WARN] Generic lsp request to gopls failed: no views 2024-03-03T16:34:06+02:00 [WARN] Generic lsp request to gopls failed: no views 2024-03-03T16:34:06+02:00 [ERROR] crates/editor/src/editor.rs:3720: no views 2024-03-03T16:34:06+02:00 [WARN] Generic lsp request to gopls failed: no views 2024-03-03T16:34:06+02:00 [ERROR] crates/editor/src/editor.rs:3673: no views 2024-03-03T16:34:08+02:00 [ERROR] unexpected item event after pane was dropped 2024-03-03T16:34:08+02:00 [WARN] Generic lsp request to gopls failed: no views 2024-03-03T16:34:08+02:00 [ERROR] inlay hint update task for range Anchor { timestamp: Lamport {0: 1}, offset: 87, bias: Left, buffer_id: Some(BufferId(2)) }..Anchor { timestamp: Lamport {65535: 4294967295}, offset: 18446744073709551615, bias: Right, buffer_id: None } failed: inlay hint fetch task: inlay hints LSP request: no views 2024-03-03T16:34:08+02:00 [WARN] Generic lsp request to gopls failed: no views 2024-03-03T16:34:08+02:00 [ERROR] inlay hint update task for range Anchor { timestamp: Lamport {0: 0}, offset: 0, bias: Left, buffer_id: None }..Anchor { timestamp: Lamport {0: 1}, offset: 86, bias: Right, buffer_id: Some(BufferId(2)) } failed: inlay hint fetch task: inlay hints LSP request: no views 2024-03-03T16:34:09+02:00 [WARN] Generic lsp request to gopls failed: no views 2024-03-03T16:34:09+02:00 [ERROR] inlay hint update task for range Anchor { timestamp: Lamport {0: 0}, offset: 0, bias: Left, buffer_id: None }..Anchor { timestamp: Lamport {0: 1}, offset: 998, bias: Right, buffer_id: Some(BufferId(2)) } failed: inlay hint fetch task: inlay hints LSP request: no views 2024-03-03T16:34:09+02:00 [WARN] Generic lsp request to gopls failed: no views 2024-03-03T16:34:09+02:00 [ERROR] inlay hint update task for range Anchor { timestamp: Lamport {0: 1}, offset: 999, bias: Left, buffer_id: Some(BufferId(2)) }..Anchor { timestamp: Lamport {65535: 4294967295}, offset: 18446744073709551615, bias: Right, buffer_id: None } failed: inlay hint fetch task: inlay hints LSP request: no views 2024-03-03T16:34:09+02:00 [WARN] Generic lsp request to gopls failed: no views 2024-03-03T16:34:09+02:00 [ERROR] crates/editor/src/editor.rs:3720: no views 2024-03-03T16:34:10+02:00 [WARN] Generic lsp request to gopls failed: no views 2024-03-03T16:34:10+02:00 [ERROR] crates/editor/src/editor.rs:3673: no views 2024-03-03T16:34:10+02:00 [WARN] Generic lsp request to gopls failed: no views 2024-03-03T16:34:11+02:00 [WARN] Generic lsp request to gopls failed: no views 2024-03-03T16:34:14+02:00 [WARN] Generic lsp request to gopls failed: no views 2024-03-03T16:34:14+02:00 [ERROR] crates/editor/src/editor.rs:3720: no views 2024-03-03T16:34:14+02:00 [WARN] Generic lsp request to gopls failed: no views 2024-03-03T16:34:14+02:00 [ERROR] crates/editor/src/editor.rs:3673: no views 2024-03-03T16:34:15+02:00 [WARN] Generic lsp request to gopls failed: no views 2024-03-03T16:34:15+02:00 [ERROR] inlay hint update task for range Anchor { timestamp: Lamport {0: 0}, offset: 0, bias: Left, buffer_id: None }..Anchor { timestamp: Lamport {0: 1}, offset: 998, bias: Right, buffer_id: Some(BufferId(2)) } failed: inlay hint fetch task: inlay hints LSP request: no views 2024-03-03T16:34:15+02:00 [WARN] Generic lsp request to gopls failed: no views 2024-03-03T16:34:15+02:00 [ERROR] crates/editor/src/editor.rs:3720: no views 2024-03-03T16:34:16+02:00 [WARN] Generic lsp request to gopls failed: no views 2024-03-03T16:34:16+02:00 [ERROR] crates/editor/src/editor.rs:3673: no views 2024-03-03T16:34:16+02:00 [WARN] Generic lsp request to gopls failed: no views 2024-03-03T16:34:16+02:00 [ERROR] inlay hint update task for range Anchor { timestamp: Lamport {0: 1}, offset: 999, bias: Left, buffer_id: Some(BufferId(2)) }..Anchor { timestamp: Lamport {65535: 4294967295}, offset: 18446744073709551615, bias: Right, buffer_id: None } failed: inlay hint fetch task: inlay hints LSP request: no views 2024-03-03T16:34:17+02:00 [WARN] Generic lsp request to gopls failed: no views 2024-03-03T16:35:55+02:00 [WARN] Generic lsp request to gopls failed: no views 2024-03-03T16:35:56+02:00 [WARN] Generic lsp request to gopls failed: no views
go command required, not found: exec: "go": executable file not found in $PATH
Same, can't use golang with Zed...
This is now fixed in v0.136.0-pre.
I am not sure why, but this seems to be broken again. Go was definitely working great in Zed a couple days ago, but I’m on 0.139.3 now and it fails with the same error described above. I am not sure it broke in that specific version though.
Funny thing is, I restarted zed and it briefly worked, and then it failed again.
Go was definitely working great in Zed a couple days ago, but I’m on 0.139.3 now and it fails with the same error described above.
Does it work if you downgrade to an older Zed then?
Do you have any concrete steps to reproduce? Any log output?
Do you have any concrete steps to reproduce? Any log output?
I ran into this after upgrading Go to 1.22.4 via goenv (though I would say it tends to happen any time Go is updated):
$ goenv install 1.22.4
$ goenv global 1.22.4
$ goenv rehash # or rm -rf $HOME/.goenv/shims/.goenv-shim; goenv rehash
$ go install golang.org/x/tools/gopls@latest
$ gopls version
golang.org/x/tools/gopls v0.16.0
Zed failure logs:
2024-06-29T20:41:06-05:00 [INFO] Took 929.75µs to receive response to "textDocument/codeAction" id 77
2024-06-29T20:41:06-05:00 [WARN] Generic lsp request to gopls failed: no views
2024-06-29T20:41:06-05:00 [ERROR] crates/editor/src/editor.rs:9505: no views
Running Zed 0.141.3.
I still cannot reproduce this, also on 0.141.3.
To avoid any confusion: how exactly do you open the project in Zed?
Here's what I do:
- I have an ESLint project open
- I open a single
main.gofile - Zed starts gopls and it works
See video:
https://github.com/zed-industries/zed/assets/1185253/0a0e31a1-90c9-4ef1-9403-447153d97181
I do step 1. and 2. because the original problem in this ticket was that gopls wouldn't work when opening a Go file with another project already open.