The code
field in the Diagnostics
structure is unexpectedly converted to a String
#24081
Closed
Markiewic
started this conversation in
Language Support
Replies: 2 comments 4 replies
-
Nice catch. To note, the real zed/crates/project/src/lsp_store.rs Lines 7369 to 7372 in 5bd7eaa and most likely we have to adjust this across the Zed's code base, as there's no good way to understand whether the original was a String or a Number, to "intervene and convert it back". Something similar happened with zed/crates/context_server/src/client.rs Lines 40 to 43 in 5bd7eaa |
Beta Was this translation helpful? Give feedback.
3 replies
-
Fixed in #24347 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm working on an Angular extension. I'm currently solving issue nathansbradshaw/zed-angular#16, which says that Angular Language Server's Code Actions don't work in Zed.
After checking, I found that Zed converts the
code
field to a string in messages with the "textDocument/codeAction" method, which is a problem for Angular, since it uses strict error code comparison when looking for Code Actions. Here's an example of the message Zed gets when asking for diagnostics, and here's what it sends later.Examples
Pay attention to the path
params.context.diagnostics[*].code
.Received from ALS:
Sent to ALS:
Most likely, the unconditional conversion to String happens here. Compared to VS Code, it doesn't do that, it passes the
code
as it received it.I intervened inside ALS and checked if this is really the reason - it turned out that it is (details in the attached issue).
I'm looking for a way to intervene in the RPC messages with an extension and convert the code back to a number. Or some other way to make sure the code's type doesn't change.
The LSP spec allows both a string and a number in this field. I believe that in this case, it is the language server that has the right to choose in what format it should accept and return numbers, and the editor should take into account either format.
Beta Was this translation helpful? Give feedback.
All reactions