Skip to content

fix(lsp): tolerate language server failures - #286

Merged
fcoury merged 1 commit into
mainfrom
fcoury/lsp-failure-resilience
Aug 20, 2026
Merged

fcoury merged 1 commit into
mainfrom
fcoury/lsp-failure-resilience

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

Language servers and their child processes can emit important stderr while the server remains healthy, and a failed document-open or diagnostics request should not prevent the editor from opening the requested file. These failures currently enter the processing-error path or bubble out of diagnostics, which can interrupt normal editing.

This change:

  • adds a dedicated ServerStderr message so important stderr remains visible without being treated as a transport failure, while still upgrading it when the server process has actually exited
  • makes document-open and diagnostics failures non-fatal to editor actions, with a structured warning log and an in-editor notification
  • adds regression coverage for panic-shaped child stderr from a running server and a failed didOpen during file navigation

How to Test

  1. Run cargo test -p red panic_shaped_stderr_does_not_fail_a_running_server -- --test-threads=1.
    Expected: panic-shaped stderr is surfaced while the server process stays alive and the client is not marked initialization-failed.
  2. Run cargo test -p red lsp_server_stderr_is_visible_without_becoming_a_processing_error -- --test-threads=1.
    Expected: the editor prints stderr as an LSP server error without mapping it to ProcessingError.
  3. Run cargo test -p red --test editing opening_file_survives_an_lsp_did_open_failure -- --test-threads=1.
    Expected: the file opens and the editor shows a Language server unavailable warning when didOpen fails.

@fcoury
fcoury merged commit 9dfc862 into main Aug 20, 2026
10 checks passed
@fcoury
fcoury deleted the fcoury/lsp-failure-resilience branch August 20, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants