Description
DiagnosticDedupKey uses (range, severity, code) when code is present, ignoring the message entirely. Two genuinely distinct diagnostics at the same span with the same error code — for example, two E0308 type-mismatch errors arising from different unsatisfied trait bounds — have the second one silently dropped.
This is the opposite of the dedup's intent: instead of removing duplicates, it hides real errors.
Reproduction Steps
- Write Rust code that produces two
E0308 errors at the same character position (e.g. a value that fails two independent trait constraints simultaneously)
- Call
get_diagnostics via MCP
- Observe: only one of the two errors is returned
Expected Behavior
All distinct diagnostics should be returned; only exact duplicates (same range, severity, code, AND message) should be collapsed.
Actual Behavior
Any two diagnostics with the same (range, severity, code) are treated as duplicates regardless of their messages.
Affected Code
crates/mcpls-core/src/bridge/translator.rs — DiagnosticDedupKey construction
Fix Direction
Include the message (or a hash of it) in DiagnosticDedupKey unconditionally, regardless of whether code is present:
DiagnosticDedupKey {
range: ...,
severity: ...,
code: diag.code.clone(),
message: diag.message.clone(), // always include
}
Environment
- Reproducible with any LSP server that emits multiple diagnostics at the same position with the same error code
- rust-analyzer, pyright, and tsgo all produce such diagnostics in certain scenarios
Description
DiagnosticDedupKeyuses(range, severity, code)whencodeis present, ignoring the message entirely. Two genuinely distinct diagnostics at the same span with the same error code — for example, twoE0308type-mismatch errors arising from different unsatisfied trait bounds — have the second one silently dropped.This is the opposite of the dedup's intent: instead of removing duplicates, it hides real errors.
Reproduction Steps
E0308errors at the same character position (e.g. a value that fails two independent trait constraints simultaneously)get_diagnosticsvia MCPExpected Behavior
All distinct diagnostics should be returned; only exact duplicates (same range, severity, code, AND message) should be collapsed.
Actual Behavior
Any two diagnostics with the same
(range, severity, code)are treated as duplicates regardless of their messages.Affected Code
crates/mcpls-core/src/bridge/translator.rs—DiagnosticDedupKeyconstructionFix Direction
Include the message (or a hash of it) in
DiagnosticDedupKeyunconditionally, regardless of whethercodeis present:Environment