Closed ZacharyRizer closed 2 months ago
The diagnostic:
[
{
"range": {},
"severity": 2,
"code": "unused_variables",
"source": "rustc",
"message": "unused variable: `chunk1`\n`#[warn(unused_variables)]` on by default",
"relatedInformation": [{}],
"tags": [
1
],
"data": {
"rendered": "warning: unused variable: `chunk1`\n --> src/main.rs:4:9\n |\n4 | let chunk1 = &s1[0..5];\n | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_chunk1`\n |\n = note: `#[warn(unused_variables)]` on by default\n\n"
}
},
{
"range": {},
"severity": 4,
"code": "unused_variables",
"source": "rustc",
"message": "if this is intentional, prefix it with an underscore: `_chunk1`",
"relatedInformation": [
{
...
"message": "original diagnostic"
}
]
}
]
The problem: there're two diagnostics on chunk1
, the first one unused variable
diagnostic contains Unnecessary
tag, coc.nvim uses this instead the warning for the first diagnostic. We should use stack these.
What's the output of
:CocInfo
What's the output of
:CocCommand rust-analyzer.serverVersion
rust-analyzer 0.3.1839-standalone (c06ca6cff 2024-02-11)
What's your coc-rust-analyzer version? You can get it from
:CocList extensions
0.75.1
The issue I'm having is that diagnostic warnings are using the hint diagnostics underline formatting. The warnings are correctly taking precedence over the hints, but the underline color and formatting is showing as if it was hint. Here is a screen shot:
You can see that the gutter and diagnostic list is correctly showing the warning diagnostics as having priority over the hints, but the underline is showing it as if it is a hint, and also the text is dull as if it is a hint. If in my coc.settings.json I set this:
"diagnostic.level": "warning",
then it will only list and show the warning, but the formatting is still off.When I look at the DiagnosticUnderline highlight groups, they are correct, guisp is yellow for warning and green for hint. And if I switch to a different lsp, the warnings are shown as expected (text is not dull, undercurl is yellow). Lua as a reference:
You can see that in the lua file the priority is correct in the gutter and in the lists, and the undercurl formatting is appropriate to the correct level.
And just for reference if I look at the same rust file in VsCode it is formatting as I would expect coc-rust-analyzer to do: