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
34.47k stars 1.71k forks source link

LSP textDocument/didOpen Message Missing Language ID #11399

Closed ejjonny closed 1 week ago

ejjonny commented 2 weeks ago

Check for existing issues

Describe the bug / provide steps to reproduce it

LSP client message textDocument/didOpen passes an empty string for textDocument.languageId.

This field is apparently necessary for language servers that support multiple languages such as sourcekit.

LSP object for reference

I believe it is crates/project/src/project.rs line ~2383 or line ~3682 defaulting on a None value.

Environment

Zed: v0.133.7 (Zed) OS: macOS 14.2.1 Memory: 16 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.

No response

SomeoneToIgnore commented 1 week ago

Nice catch, thank you. https://github.com/zed-industries/zed/pull/11412 is supposed to fix that, using a lowercased language name as a fallback now, will be released with Zed 0.135

ejjonny commented 1 week ago

Awesome! Thank you!

furby-tm commented 1 week ago

@ejjonny hmm I pulled these changes in and I attempted to use your Swift extension just now but it's still doing the same thing that the broken extension has always done with no sourcekit-lsp support, was this change supposed to allow things to begin working?

ejjonny commented 1 week ago

@furby-tm Yeah, the published swift plugin has no language server, just syntax highlighting with tree sitter.

As far as my repo - it needed to point to a tree sitter branch with some generated files to install properly. If you pull down the latest commit you (should?) be able to get up and running.

It might help to run export RUST_LOG=info in the terminal session you launch Zed with so you can better see what is happening during installation.

If you don't see this (after a couple minutes) in your extensions window in Zed, the plugin didn't install successfully. image

The standard LSP things should work - however the diagnostics message seems to be broken for me. If you do manage to get up and running you should let me know if you see the same deserialization warning I'm seeing.