Fix LSP timesheet diagnostics: doubled prefix, duplicate publish, cross-file dates #137
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "136_lsp-timesheet-diagnostics-fixes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #136.
Summary
"Timesheet error:"prefix:StreamdError::TimesheetError'sDisplayalready includes the prefix;lsp.rswas adding it a second time when building the diagnostic message.publish_diagnosticsondidOpen/didChange/didSaveand answered pull requests (textDocument/diagnostic), so a client that declaredtextDocument.diagnosticsupport got every diagnostic twice, in non-deterministic order relative to the push. Now the server checks the client's declared capabilities atinitializeand skips the unsolicited push for pull-capable clients.diagnosticProvider.interFileDependenciesis also flipped totrueto reflect the cross-file dependency introduced below.streamd timesheetcommand already accounts for viaload_markdown_shards). This caused false positives (a real closing@Breakliving in a sibling file) and false negatives (overlaps only visible once sibling files are merged in).compute_diagnosticsnow merges the open file with every other repository file that shares at least one timesheet date with it before callingextract_timesheets, and only reports diagnostics for dates the open file itself contributes to — so an unrelated file's own violation (including one that aborts the whole computation) can never surface on this file.Also included
While testing the timesheet state machine for the above, found and fixed a separate bug: an unclosed
@Timesheetcard logged for later today (before that time actually arrives — e.g. planning ahead) produced an inverted timecard (e.g.from 12:00 to 11:00), because the synthetic "close at now" fallback inaggregate_timecard_daydidn't check thatnowwas actually after the card's start time. Now clamped to a zero-duration timecard instead.Test plan
cargo test— 211 tests pass, including new regression tests for all four fixes (doubled-message, cross-file merge, cross-file date attribution, inverted-timecard clamp)cargo clippy --all-targets -- -D warningscargo fmtnix flake check