Description
When a client subscribes to an lsp-diagnostics:// URI after the LSP server has already published its first publishDiagnostics notification for that file, the subscriber will never see those diagnostics until the next LSP push. The subscription silently succeeds but delivers no data.
This is marked TODO(critic-S3) in crates/mcpls-core/src/lib.rs at the point where notify_resource_updated is conditionally sent.
Reproduction Steps
- Start mcpls against a project.
- Open a file (triggering
textDocument/didOpen).
- Wait for the initial
publishDiagnostics push from the LSP server.
- Subscribe via
resources/subscribe for the file's lsp-diagnostics:// URI.
- Observe: no
notifications/resources/updated is sent for the already-cached diagnostics.
- The subscriber must wait for the next LSP-triggered
publishDiagnostics push before receiving any data.
Expected Behavior
On subscribe, if cached diagnostics already exist for the requested URI, notify_resource_updated should be sent immediately (or the cached data should be replayed via read_resource).
Actual Behavior
No immediate notification is sent. The client is left waiting indefinitely if the LSP server does not re-push diagnostics.
Environment
- Version: HEAD 0f40608
- Features: all-features
Logs / Evidence
crates/mcpls-core/src/lib.rs — TODO comment:
// TODO(critic-S3): on subscribe, replay cached diagnostics once
// so clients that subscribe after the first PublishDiagnostics
// do not have to wait for the next LSP push.
Description
When a client subscribes to an
lsp-diagnostics://URI after the LSP server has already published its firstpublishDiagnosticsnotification for that file, the subscriber will never see those diagnostics until the next LSP push. The subscription silently succeeds but delivers no data.This is marked
TODO(critic-S3)incrates/mcpls-core/src/lib.rsat the point wherenotify_resource_updatedis conditionally sent.Reproduction Steps
textDocument/didOpen).publishDiagnosticspush from the LSP server.resources/subscribefor the file'slsp-diagnostics://URI.notifications/resources/updatedis sent for the already-cached diagnostics.publishDiagnosticspush before receiving any data.Expected Behavior
On subscribe, if cached diagnostics already exist for the requested URI,
notify_resource_updatedshould be sent immediately (or the cached data should be replayed viaread_resource).Actual Behavior
No immediate notification is sent. The client is left waiting indefinitely if the LSP server does not re-push diagnostics.
Environment
Logs / Evidence
crates/mcpls-core/src/lib.rs— TODO comment: