rust-lang / rust-lang/rust-analyzer
textDocument/publishDiagnostics: empty diagnostic messages
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
I have a question regarding some empty diagnostic messages. As can be seen in the picture below, I am getting diagnostics on all enum variant fields in this scenario, however the diagnostics are just a whitespace character for the first two tuple fields (this is the reason there is a line, but no message).
Looking at the rust-analyzer information, this can also be seen with multiple instances of the message key having a value of a whitespace character.
I am wondering if this is the intended behaviour, and the diagnostic "highlights" are just to indicate that there are three fields, with the third containing the message - or if there is supposed to be information on the first two fields, or if they are even supposed to be marked at all?
{
"jsonrpc":"2.0",
"method":"textDocument/publishDiagnostics",
"params":{
"uri":"file:///home/krath/Documents/kasm/src/instruction/mod.rs",
"diagnostics":[
{
"range":{
"start":{
"line":46,
"character":4
},
"end":{
"line":46,
"character":8
}
},
"severity":4,
"code":"E0061",
"codeDescription":{
"href":"https://doc.rust-lang.org/error-index.html#E0061"
},
"source":"rustc",
"message":"tuple variant defined here",
"relatedInformation":[
{
"location":{
"uri":"file:///home/krath/Documents/kasm/src/decode/jump.rs",
"range":{
"start":{
"line":14,
"character":11
},
"end":{
"line":14,
"character":28
}
}
},
"message":"original diagnostic"
}
]
},
{
"range":{
"start":{
"line":46,
"character":9
},
"end":{
"line":46,
"character":13
}
},
"severity":4,
"code":"E0023",
"codeDescription":{
"href":"https://doc.rust-lang.org/error-index.html#E0023"
},
"source":"rustc",
"message":" ",
"relatedInformation":[
{
"location":{
"uri":"file:///home/krath/Documents/kasm/src/execute/mod.rs",
"range":{
"start":{
"line":43,
"character":40
},
"end":{
"line":43,
"character":47
}
}
},
"message":"original diagnostic"
}
]
},
{
"range":{
"start":{
"line":46,
"character":15
},
"end":{
"line":46,
"character":28
}
},
"severity":4,
"code":"E0023",
"codeDescription":{
"href":"https://doc.rust-lang.org/error-index.html#E0023"
},
"source":"rustc",
"message":" ",
"relatedInformation":[
{
"location":{
"uri":"file:///home/krath/Documents/kasm/src/execute/mod.rs",
"range":{
"start":{
"line":43,
"character":40
},
"end":{
"line":43,
"character":47
}
}
},
"message":"original diagnostic"
}
]
},
{
"range":{
"start":{
"line":46,
"character":30
},
"end":{
"line":46,
"character":46
}
},
"severity":4,
"code":"E0023",
"codeDescription":{
"href":"https://doc.rust-lang.org/error-index.html#E0023"
},
"source":"rustc",
"message":"tuple variant has 3 fields",
"relatedInformation":[
{
"location":{
"uri":"file:///home/krath/Documents/kasm/src/execute/mod.rs",
"range":{
"start":{
"line":43,
"character":40
},
"end":{
"line":43,
"character":47
}
}
},
"message":"original diagnostic"
}
]
}
],
"version":0
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported tuple-variant mismatch and inspecting the textDocument/publishDiagnostics output alongside the rustc diagnostics and rust-analyzer information. Determine whether whitespace messages and their ranges are intended; done means the expected behavior is established and, if needed, covered by a focused fix and regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100