Repository navigation
fix(core): don't warn when tree-sitter highlight fails during client destroy - #1318
HARIOM-JHA01 wants to merge 1 commit into
Conversation
…destroy The TreeSitterClient used a generic Error for teardown rejections, so CodeRenderable treated an expected destroy() during shutdown as a real failure and logged 'Code highlighting failed, falling back to plain text'. Introduce TreeSitterClientDestroyedError and skip the warning (and pointless fallback render) when highlighting fails because the client was destroyed, while preserving warnings for genuine worker failures.
|
Still reproducing on opencode 1.18.18 (macOS, arm64). That tag pins Triggered by One detail worth noting: it lands on the raw terminal rather than the TUI console pane, because The typed- |
Fixes #1319
Problem
When @opentui/core is torn down, TreeSitterClient.destroy() rejects any in-flight highlightOnce() promises with a generic
Error("TreeSitter client destroyed"). CodeRenderable.startHighlight() treats every rejection as a real failure and logs a misleading warning:This races with client teardown on exit, so opencode users see the warning unexpectedly on shutdown even though nothing is actually broken.
Reported in anomalyco/opencode#36454.
Fix
TreeSitterClientDestroyedErrorand reject pending requests (and pending initialization) with it indestroy().rejectHighlightOnce; client destroy tests now assertTreeSitterClientDestroyedError;console.warnon destroy-triggered failures while a real Error still warns.Tests