Skip to content

fix(editor): keep lsp failures from aborting editing - #423

Merged
fcoury merged 1 commit into
mainfrom
fcoury/nonfatal-lsp-errors
Oct 25, 2026
Merged

fcoury merged 1 commit into
mainfrom
fcoury/nonfatal-lsp-errors

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

An unavailable language server can terminate the editor when a command such as K or gd returns an LSP error. Document synchronization can also propagate an error after the buffer has already changed, interrupting the rest of the edit notification.

Handle LSP failures as warnings at the keyboard-command boundary and during document synchronization. Editing and plugin change notifications continue, and unrelated errors retain their existing handling. Add regressions for join, dot repeat, undo, and save after failed didOpen/didChange calls, plus hover and definition requests against a missing Markdown server.

How to Test

  1. Create scratch.md with four lines: alpha, beta, gamma, and delta. Launch with:
    cargo run -- -c 'lsp.servers.markdown.command = "red-missing-language-server"' scratch.md
  2. Press K, then gd. Each should show a language-server warning while leaving the editor open and the text unchanged. Before this fix, K reproduced the fatal LSP protocol error: language server unavailable exit.
  3. Press Jj.: the buffer should contain alpha beta and gamma delta. Press uu to restore the four original lines, then J and :wq. Confirm the joined first line is saved and Red exits normally.
  4. Run cargo test --test editing --test lsp_lazy --test lsp_save. The new joining_lines_survives_lsp_sync_failure_and_remains_undoable test injects both document-open and document-change failures; unavailable_markdown_lsp_does_not_abort_commands_or_later_edits covers a missing server executable.

Validation

All 570 tests across those suites passed, along with formatting and cargo clippy --all-targets --all-features -- -D warnings. Terminal checks confirmed that J and the previously fatal K allow subsequent editing and saving.

Local validation used temporary, uncommitted Wasmtime 48.0.5 and zip 9.0.3 pins because the configured registry could not resolve the production dependencies. Those pins are excluded from this PR; validation against the committed dependency set remains for CI.

@fcoury

fcoury commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T02:05:23.339053Z e0b41a4 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: e0b41a41ee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@fcoury
fcoury merged commit a65b280 into main Oct 25, 2026
12 checks passed
@fcoury
fcoury deleted the fcoury/nonfatal-lsp-errors branch October 25, 2026 02:07
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