You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix streaming performance bottlenecks in thinking blocks and redisplay (dnouri#153)
* Fix streaming performance bottlenecks in thinking blocks and redisplay
Thinking-block rendering was O(n) in accumulated content: every delta
deleted and reinserted the entire blockquote region. Track previously
rendered text and append only the new suffix when possible, falling
back to full rewrite only when normalization alters earlier content.
Bind inhibit-redisplay in the process filter so that multiple JSON
lines delivered in one read() produce a single redisplay cycle.
Filter function-based entries from treesit-range-settings when
harvesting embedded-mode configs in md-ts-mode. Such entries create
host-level parsers that re-parse the whole buffer on every redisplay.
* pi-coding-agent-render.el (pi-coding-agent--render-thinking-content):
Use incremental suffix insertion; track state in new variable
pi-coding-agent--thinking-prev-rendered.
(pi-coding-agent--reset-thinking-state): Clear it.
* pi-coding-agent-ui.el (pi-coding-agent--thinking-prev-rendered): New.
* pi-coding-agent-core.el (pi-coding-agent--process-filter):
Bind inhibit-redisplay around the dispatch loop.
* md-ts-mode.el (md-ts--add-config-for-mode):
Keep only query-based range settings; drop function-based ones.
* test/pi-coding-agent-core-test.el: Test that inhibit-redisplay is
bound during dispatch.
* test/pi-coding-agent-render-test.el: Test incremental suffix path,
tool-header short-circuit, and range-settings filtering.
* Sync md-ts-mode.el with upstream (dnouri/md-ts-mode bd2ac57)
Picks up two fixes from upstream that affect streaming sessions:
Workaround for tree-sitter < 0.25.0 integer underflow in local
parsers. After an edit outside a local parser's included range,
unsigned subtraction in length_sub/point_sub corrupts point fields
and makes incremental reparse silently return zero query matches.
Inline markup (backticks, bold, links) fails to fontify when
content is inserted line by line, as happens during LLM streaming.
The workaround recreates each local parser when the buffer has been
modified since the parser was last updated, forcing a full reparse.
Filter function-based range settings when harvesting embedded mode
configs. Function-based entries create host-level parsers that
re-parse the whole buffer as the embedded language on every
redisplay cycle.
The range-settings filter test moves to the upstream test suite;
remove the local copy from pi-coding-agent-render-test.el.
0 commit comments