You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some LSP servers provide pull diagnostic support and publish diagnostics for different sources (e.g. rust-analyzer, rust-lang/rust-analyzer#18709 (comment)) and currently diagnostics will override each other.
Different sources of diagnostics should be processed separately (at least pull diagnostics with provided identifier should be processed separately from publish diagnostics and pull diagnostics with other identifiers).
@n1kolasM it should work. I have used your LSP traces to write tests and I have tested quicly with your sample andit is working.
The only thing that I have noticed is that the first time (when file is opened in the editor), you don't see error from pull diagnostics because rust analyzer send an empty testDocument/diagnostics.
Activity
angelozerr commentedon Apr 16, 2025
Is there any chance to have a contribution for this issue?
n1kolasM commentedon Apr 16, 2025
We have no plans to fix it yet, just disabling pull diagnostics in Huly Code for now
angelozerr commentedon Apr 16, 2025
Ok no problem, could you explain how to reproduce this issue?
n1kolasM commentedon Apr 16, 2025
cargo initand open it in IDEA2024-10-28, minimal version with added identifier for pull diagnostics2025-03-03src/main.rs, replace file contents withand use
Ctrl-Sto save fileExpected result:
Diagnostics highlighting
NoneandletActual result:
Diagnostics highlighting only
letPartial trace
[Trace - 12:34:22] Sending notification 'textDocument/didSave' Params: { "textDocument": { "uri": "file:///sample-rust-project/src/main.rs" }, "text": "fn main() {\n println!(None);\n let\n}" } [Trace - 12:34:22] Received notification 'textDocument/publishDiagnostics' Params: { "uri": "file:///sample-rust-project/src/main.rs", "diagnostics": [ { "range": { "start": { "line": 3, "character": 0 }, "end": { "line": 3, "character": 1 } }, "severity": 1, "source": "rustc", "message": "expected pattern, found `}`\nexpected pattern", "data": { "rendered": "error: expected pattern, found `}`\n --\u003e src/main.rs:4:1\n |\n4 | }\n | ^ expected pattern\n\n" } } ], "version": 3 } [Trace - 12:34:22] Received notification 'textDocument/publishDiagnostics' Params: { "uri": "file:///sample-rust-project/src/main.rs", "diagnostics": [ { "range": { "start": { "line": 3, "character": 0 }, "end": { "line": 3, "character": 1 } }, "severity": 1, "source": "rustc", "message": "expected pattern, found `}`\nexpected pattern", "data": { "rendered": "error: expected pattern, found `}`\n --\u003e src/main.rs:4:1\n |\n4 | }\n | ^ expected pattern\n\n" } }, { "range": { "start": { "line": 1, "character": 13 }, "end": { "line": 1, "character": 17 } }, "severity": 1, "source": "rustc", "message": "format argument must be a string literal", "relatedInformation": [ { "location": { "uri": "file:///sample-rust-project/src/main.rs", "range": { "start": { "line": 1, "character": 13 }, "end": { "line": 1, "character": 13 } } }, "message": "you might be missing a string literal to format with: `\"{}\", `" } ], "data": { "rendered": "error: format argument must be a string literal\n --\u003e src/main.rs:2:14\n |\n2 | println!(None);\n | ^^^^\n |\nhelp: you might be missing a string literal to format with\n |\n2 | println!(\"{}\", None);\n | +++++\n\n" } }, { "range": { "start": { "line": 1, "character": 13 }, "end": { "line": 1, "character": 13 } }, "severity": 4, "source": "rustc", "message": "you might be missing a string literal to format with: `\"{}\", `", "relatedInformation": [ { "location": { "uri": "file:///sample-rust-project/src/main.rs", "range": { "start": { "line": 1, "character": 13 }, "end": { "line": 1, "character": 17 } } }, "message": "original diagnostic" } ] } ], "version": 3 } [Trace - 12:34:22] Sending request 'textDocument/diagnostic - (284)'. Params: { "textDocument": { "uri": "file:///sample-rust-project/src/main.rs" } } [Trace - 12:34:22] Received response 'textDocument/diagnostic - (284)' in 1ms. Result: { "kind": "full", "resultId": "rust-analyzer", "items": [ { "range": { "start": { "line": 2, "character": 7 }, "end": { "line": 2, "character": 7 } }, "severity": 1, "code": "syntax-error", "codeDescription": { "href": "https://doc.rust-lang.org/stable/reference/" }, "source": "rust-analyzer", "message": "Syntax Error: expected pattern" }, { "range": { "start": { "line": 2, "character": 7 }, "end": { "line": 2, "character": 7 } }, "severity": 1, "code": "syntax-error", "codeDescription": { "href": "https://doc.rust-lang.org/stable/reference/" }, "source": "rust-analyzer", "message": "Syntax Error: expected SEMICOLON" } ] }angelozerr commentedon Apr 16, 2025
Thanks for your detailled explanation!
Let me investigate to implement a fix.
Disable pull diagnostics for rust-analyzer
fix: Pull diagnostics overwriting publish diagnostics
fix: Pull diagnostics overwriting publish diagnostics
fix: Pull diagnostics overwriting publish diagnostics
fix: Pull diagnostics overwriting publish diagnostics
5 remaining items
fix: Pull diagnostics overwriting publish diagnostics
fix: Pull diagnostics overwriting publish diagnostics
fix: Pull diagnostics overwriting publish diagnostics
fix: Pull diagnostics overwriting publish diagnostics
fix: Pull diagnostics overwriting publish diagnostics
fix: Pull diagnostics overwriting publish diagnostics
fix: Pull diagnostics overwriting publish diagnostics
fix: Pull diagnostics overwriting publish diagnostics
fix: Pull diagnostics overwriting publish diagnostics
fix: Pull diagnostics overwriting publish diagnostics
fix: Pull diagnostics overwriting publish diagnostics
angelozerr commentedon Apr 19, 2025
@n1kolasM it should work. I have used your LSP traces to write tests and I have tested quicly with your sample andit is working.
The only thing that I have noticed is that the first time (when file is opened in the editor), you don't see error from pull diagnostics because rust analyzer send an empty testDocument/diagnostics.