The code
field in the Diagnostics
structure is unexpectedly converted to a String
#24084
Labels
bug
[core label]
Discussed in #24081
Originally posted by Markiewic February 1, 2025
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:
As said @SomeoneToIgnore, the conversion to String happens here:
zed/crates/project/src/lsp_store.rs
Lines 7369 to 7372 in 5bd7eaa
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.
The text was updated successfully, but these errors were encountered: