zed-industries / zed

Code at the speed of thought ā€“ Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
51.11k stars 3.18k forks source link

Go to Definition is janky in monorepos (mostly LSP issue) #4353

Open rranjan14 opened 1 year ago

rranjan14 commented 1 year ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Go to Definition sometimes doesn't work in the monorepo setup I have. It's an Nx managed monorepo with all the apps and libraries in typescript. Doing Cmd + click or pressing f12 on the imports doesn't do anything. Typescript version being used is 5.1.3.

Environment

Hardware:

Hardware Overview:

  Model Name: MacBook Pro
  Model Identifier: Mac14,7
  Model Number: Z16R0006KHN/A
  Chip: Apple M2
  Total Number of Cores: 8 (4 performance and 4 efficiency)
  Memory: 16 GB
  System Firmware Version: 10151.41.12
  OS Loader Version: 10151.41.12
  Serial Number (system): CD9J6ND2GD
  Hardware UUID: 4C231FBC-BE1E-53F0-BEB9-C7B6578E4F16
  Provisioning UDID: 00008112-0014705C1E78201E
  Activation Lock Status: Enabled

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.

No response

MAG-AdrianMeredith commented 10 months ago

I have the almost exact setup and I don't get any sort of intellisense, no obvious errors just nothing happens. no go to or autocomplete/intellisense

rranjan14 commented 10 months ago

@MAG-AdrianMeredith facing the same thing

tejisin commented 10 months ago

Same issue with a single file python script. F12 doesn't do anything. Zed logs have this...

2024-01-29T18:48:31 [INFO] ========== starting zed ==========
2024-01-29T18:48:31 [INFO] Opening main db
2024-01-29T18:48:31 [ERROR] crates/zed/src/zed.rs:538: EOF while parsing a value at line 1 column 0
2024-01-29T18:48:31 [INFO] Opening main db
2024-01-29T18:48:31 [INFO] build git repository ".git"
2024-01-29T18:48:31 [INFO] Opening main db
2024-01-29T18:48:31 [INFO] Opening main db
2024-01-29T18:48:31 [ERROR] crates/workspace/src/persistence/model.rs:257: No path stored for this editor
2024-01-29T18:48:31 [INFO] starting language server "pyright", path: "/Users/username/dev_wip/specctl", id: 1
2024-01-29T18:48:31 [INFO] Node runtime install_if_needed
2024-01-29T18:48:32 [INFO] 0 unhandled notification LogMessage:
{
  "level": 0,
  "message": "[DEBUG] [agent] [2024-01-29T18:48:32.519Z] Agent service starting",
  "metadataStr": "[DEBUG] [agent] [2024-01-29T18:48:32.519Z]",
  "extra": [
    "Agent service starting"
  ]
}
2024-01-29T18:48:32 [INFO] 0 unhandled notification client/registerCapability:
{
  "registrations": [
    {
      "id": "d12e66d6-bcbf-4387-b00c-df91af6aa8ee",
      "method": "workspace/didChangeWorkspaceFolders",
      "registerOptions": {}
    }
  ]
}
2024-01-29T18:48:32 [INFO] set environment variables from shell:/opt/homebrew/bin/bash, path:/Users/username/.nvm/versions/node/v16.20.2/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/opt/homebrew/bin:/usr/local/bin:/Users/username/bin:/opt/homebrew/opt/fzf/bin
2024-01-29T18:48:32 [INFO] Node runtime install_if_needed
2024-01-29T18:48:33 [INFO] 0 unhandled notification LogMessage:
{
  "level": 0,
  "message": "[DEBUG] [agent] [2024-01-29T18:48:33.024Z] Telemetry initialized",
  "metadataStr": "[DEBUG] [agent] [2024-01-29T18:48:33.024Z]",
  "extra": [
    "Telemetry initialized"
  ]
}
2024-01-29T18:48:33 [INFO] Node runtime install_if_needed
2024-01-29T18:48:35 [INFO] Node runtime install_if_needed
2024-01-29T18:48:36 [ERROR] crates/lsp/src/lsp.rs:255: invalid LSP message header ""
2024-01-29T18:48:36 [ERROR] failed to start language server "pyright": oneshot canceled
2024-01-29T18:48:36 [ERROR] server stderr: Some("node:internal/modules/cjs/loader:1078\n  throw err;\n  ^\n\nError: Cannot find module '/Users/username/Library/Application Support/Zed/languages/pyright/node_modules/pyright/langserver.index.js'\n    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)\n    at Module._load (node:internal/modules/cjs/loader:920:27)\n    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)\n    at node:internal/main/run_main_module:23:47 {\n  code: 'MODULE_NOT_FOUND',\n  requireStack: []\n}\n\nNode.js v18.15.0\n")
2024-01-29T18:48:36 [ERROR] crates/lsp/src/lsp.rs:277: Broken pipe (os error 32)
2024-01-29T18:48:36 [ERROR] crates/lsp/src/lsp.rs:615: server shut down
2024-01-29T18:48:36 [ERROR] missing executable in directory "/Users/username/Library/Application Support/Zed/languages/pyright/node_modules/pyright/langserver.index.js"
2024-01-29T18:48:36 [INFO] About to spawn test binary
2024-01-29T18:48:36 [WARN] test binary failed to launch
2024-01-29T18:48:36 [WARN] test binary check failed
2024-01-29T18:48:36 [INFO] beginning to reinstall server
2024-01-29T18:48:36 [INFO] deleting server container
2024-01-29T18:48:36 [INFO] starting language server "pyright", path: "/Users/username/dev_wip/specctl", id: 2
2024-01-29T18:48:36 [INFO] Node runtime install_if_needed
2024-01-29T18:48:38 [INFO] Node runtime install_if_needed
2024-01-29T18:48:39 [INFO] Node runtime install_if_needed
2024-01-29T18:48:40 [ERROR] crates/lsp/src/lsp.rs:255: invalid LSP message header ""
2024-01-29T18:48:40 [ERROR] failed to start language server "pyright": oneshot canceled
2024-01-29T18:48:40 [ERROR] server stderr: Some("node:internal/modules/cjs/loader:1078\n  throw err;\n  ^\n\nError: Cannot find module '/Users/username/Library/Application Support/Zed/languages/pyright/node_modules/pyright/langserver.index.js'\n    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)\n    at Module._load (node:internal/modules/cjs/loader:920:27)\n    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)\n    at node:internal/main/run_main_module:23:47 {\n  code: 'MODULE_NOT_FOUND',\n  requireStack: []\n}\n\nNode.js v18.15.0\n")
2024-01-29T18:48:40 [ERROR] crates/lsp/src/lsp.rs:277: Broken pipe (os error 32)
2024-01-29T18:48:40 [ERROR] crates/lsp/src/lsp.rs:615: server shut down
2024-01-29T18:48:40 [ERROR] missing executable in directory "/Users/username/Library/Application Support/Zed/languages/pyright/node_modules/pyright/langserver.index.js"
2024-01-29T18:48:40 [INFO] About to spawn test binary
2024-01-29T18:48:40 [WARN] test binary failed to launch
2024-01-29T18:48:40 [WARN] test binary check failed
2024-01-29T18:48:40 [INFO] beginning to reinstall server
2024-01-29T18:48:40 [INFO] deleting server container
2024-01-29T18:48:40 [INFO] starting language server "pyright", path: "/Users/username/dev_wip/specctl", id: 3
2024-01-29T18:48:40 [INFO] Node runtime install_if_needed
2024-01-29T18:48:41 [INFO] Node runtime install_if_needed
2024-01-29T18:48:42 [INFO] Node runtime install_if_needed
2024-01-29T18:48:43 [ERROR] crates/lsp/src/lsp.rs:255: invalid LSP message header ""
2024-01-29T18:48:43 [ERROR] failed to start language server "pyright": oneshot canceled
2024-01-29T18:48:43 [ERROR] server stderr: Some("node:internal/modules/cjs/loader:1078\n  throw err;\n  ^\n\nError: Cannot find module '/Users/username/Library/Application Support/Zed/languages/pyright/node_modules/pyright/langserver.index.js'\n    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)\n    at Module._load (node:internal/modules/cjs/loader:920:27)\n    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)\n    at node:internal/main/run_main_module:23:47 {\n  code: 'MODULE_NOT_FOUND',\n  requireStack: []\n}\n\nNode.js v18.15.0\n")
2024-01-29T18:48:43 [ERROR] crates/lsp/src/lsp.rs:277: Broken pipe (os error 32)
2024-01-29T18:48:43 [ERROR] crates/lsp/src/lsp.rs:615: server shut down
2024-01-29T18:48:43 [ERROR] missing executable in directory "/Users/username/Library/Application Support/Zed/languages/pyright/node_modules/pyright/langserver.index.js"
2024-01-29T18:48:43 [INFO] About to spawn test binary
2024-01-29T18:48:43 [WARN] test binary failed to launch
2024-01-29T18:48:43 [WARN] test binary check failed
2024-01-29T18:48:43 [INFO] beginning to reinstall server
2024-01-29T18:48:43 [INFO] deleting server container
2024-01-29T18:48:43 [INFO] starting language server "pyright", path: "/Users/username/dev_wip/specctl", id: 4
2024-01-29T18:48:43 [INFO] Node runtime install_if_needed
2024-01-29T18:48:44 [INFO] Node runtime install_if_needed
2024-01-29T18:48:46 [INFO] Node runtime install_if_needed
2024-01-29T18:48:48 [ERROR] crates/lsp/src/lsp.rs:255: invalid LSP message header ""
2024-01-29T18:48:48 [ERROR] failed to start language server "pyright": oneshot canceled
2024-01-29T18:48:48 [ERROR] server stderr: Some("node:internal/modules/cjs/loader:1078\n  throw err;\n  ^\n\nError: Cannot find module '/Users/username/Library/Application Support/Zed/languages/pyright/node_modules/pyright/langserver.index.js'\n    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)\n    at Module._load (node:internal/modules/cjs/loader:920:27)\n    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)\n    at node:internal/main/run_main_module:23:47 {\n  code: 'MODULE_NOT_FOUND',\n  requireStack: []\n}\n\nNode.js v18.15.0\n")
2024-01-29T18:48:48 [ERROR] crates/lsp/src/lsp.rs:277: Broken pipe (os error 32)
2024-01-29T18:48:48 [ERROR] crates/lsp/src/lsp.rs:615: server shut down
2024-01-29T18:48:48 [ERROR] missing executable in directory "/Users/username/Library/Application Support/Zed/languages/pyright/node_modules/pyright/langserver.index.js"
2024-01-29T18:48:48 [INFO] About to spawn test binary
2024-01-29T18:48:48 [WARN] test binary failed to launch
2024-01-29T18:48:48 [WARN] test binary check failed
2024-01-29T18:48:48 [INFO] beginning to reinstall server
2024-01-29T18:48:48 [INFO] deleting server container
2024-01-29T18:48:48 [INFO] starting language server "pyright", path: "/Users/username/dev_wip/specctl", id: 5
2024-01-29T18:48:48 [INFO] Node runtime install_if_needed
2024-01-29T18:48:50 [INFO] Node runtime install_if_needed
2024-01-29T18:48:52 [INFO] Node runtime install_if_needed
2024-01-29T18:48:54 [ERROR] crates/lsp/src/lsp.rs:255: invalid LSP message header ""
2024-01-29T18:48:54 [ERROR] failed to start language server "pyright": oneshot canceled
2024-01-29T18:48:54 [ERROR] server stderr: Some("node:internal/modules/cjs/loader:1078\n  throw err;\n  ^\n\nError: Cannot find module '/Users/username/Library/Application Support/Zed/languages/pyright/node_modules/pyright/langserver.index.js'\n    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)\n    at Module._load (node:internal/modules/cjs/loader:920:27)\n    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)\n    at node:internal/main/run_main_module:23:47 {\n  code: 'MODULE_NOT_FOUND',\n  requireStack: []\n}\n\nNode.js v18.15.0\n")
2024-01-29T18:48:54 [ERROR] Hit 4 reinstallation attempts for "pyright"
2024-01-29T18:48:54 [ERROR] crates/lsp/src/lsp.rs:615: server shut down
2024-01-29T18:48:54 [ERROR] crates/lsp/src/lsp.rs:277: Broken pipe (os error 32)
shellscape commented 10 months ago

@JosephTLyons seeing this now on 0.122.2 in a monorepo, where previously it was working. Looks like a regression. Logs: https://gist.github.com/shellscape/e285e2af55ae783af61701658bc2ce52

Oodles of Generic lsp request to node failed: <semantic> TypeScript Server Error (5.1.6) Could not find source file: errors for source files which actually do exist at the path which is being logged.

shellscape commented 10 months ago

Quick followup: When this issue is present, if I choose a symbol which has some intellisense associated with it (like an object) and I keypress ., intellisense pops up correctly and then Go To Definition starts working again. Even within files that the logs are saying cannot be found.

github-actions[bot] commented 2 months ago

Hi there! šŸ‘‹ We're working to clean up our issue tracker by closing older issues that might not be relevant anymore. Are you able to reproduce this issue in the latest version of Zed? If so, please let us know by commenting on this issue and we will keep it open; otherwise, we'll close it in a week. Feel free to open a new issue if you're seeing this message after the issue has been closed. Thanks for your help!

github-actions[bot] commented 1 month ago

This issue was closed due to inactivity; feel free to open a new issue if you're still experiencing this problem!

shellscape commented 1 month ago

@JosephTLyons heyo

JosephTLyons commented 1 month ago

@JosephTLyons heyo

Thanks - reopened!