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
48.1k stars 2.84k forks source link

Search project symbols not working on _python_ project #16749

Open Tsirimaholy opened 1 month ago

Tsirimaholy commented 1 month ago

Check for existing issues

Describe the bug / provide steps to reproduce it

The project symbols search does not work when I'm on a python project when I update to Zed 0.149.5.

Environment

Zed: v0.149.5 (Zed) OS: Linux Wayland debian 6.2 Memory: 11.6 GiB Architecture: x86_64 GPU: Intel(R) HD Graphics 5500 (BDW GT2) || Intel open-source Mesa driver || Mesa 22.3.6

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log

2024-08-23T15:24:28.895340981+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:29.259927959+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:29.261055695+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:29.466385276+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:29.485074756+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:29.926140834+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:29.927463591+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:30.089511803+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:30.089643665+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:30.25081833+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:30.251634769+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:30.649705298+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:30.649822298+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:30.773001296+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:30.773081948+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:30.920650152+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:30.920848854+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:31.482450742+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:31.495343538+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:31.732334966+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:31.732450724+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:31.882809744+03:00 [ERROR] Unhandled method workspace/symbol
2024-08-23T15:24:31.883773417+03:00 [ERROR] Unhandled method workspace/symbol
Tsirimaholy commented 1 month ago

I think this issue is related to the Desktop Environment, KDE Wayland. I've tested it on other DE and it works correctly. Same for #16117.

JosephTLyons commented 1 month ago

I'm actually thinking this might be a deficiency within pyright itself.

Tsirimaholy commented 1 month ago

I'm actually thinking this might be a deficiency within pyright itself.

That's possible, because it starts not working too on even on non KDE DE. And the log are the sames T.T.

lvignoli commented 2 weeks ago

@JosephTLyons turning off ruff alongside pyright makes workspace symbol search work! See there, and I was able to reproduce it locally.

So it seems to be a problem of colocation between the two LSPs of pyright and ruff.

Regarding project symbols search, I could not tell if they are provided by pyright or if Zed provides some stub implementation of it specifically for Python.


Specs: Zed: v0.153.4 (Zed Preview) OS: macOS 14.4.1 Memory: 16 GiB Architecture: aarch64

JosephTLyons commented 2 weeks ago

I don't think Zed has anything to do with project symbol search, but we are responsible for the outline view of the current file, as we use tree sitter to capture those.

skroth commented 2 weeks ago

How does Zed decide which LSP to send the symbol search to? Presumably we would want it to go to pyright and not ruff in this case.

EDIT: Also, uninstalling the ruff extension did not solve this for me. @lvignoli how did you turn off ruff?

lvignoli commented 2 weeks ago

@skroth I enabled it in my config, so I manually removed it:

 "languages": {
    "Python": {
      "format_on_save": "on",
      "formatter": [
        { "code_actions": { "source.organizeImports.ruff": true } },
        { "language_server": { "name": "ruff" } }
      ],
-     "language_servers": ["pyright", "ruff"]
+     "language_servers": ["pyright"]
    },
}
Tsirimaholy commented 2 weeks ago

@skroth I enabled it in my config, so I manually removed it:

 "languages": {
    "Python": {
      "format_on_save": "on",
      "formatter": [
        { "code_actions": { "source.organizeImports.ruff": true } },
        { "language_server": { "name": "ruff" } }
      ],
-     "language_servers": ["pyright", "ruff"]
+     "language_servers": ["pyright"]
    },
}

Yesss. I test that and it work. But the question is now how can i use pyright alongside ruff lsps.