Skip to content

Conversation

@ompugao
Copy link
Owner

@ompugao ompugao commented Dec 16, 2025

No description provided.

@ompugao ompugao force-pushed the feat/debounce_preview branch from 7a5a3c4 to 44940e2 Compare December 18, 2025 06:42
@ompugao ompugao marked this pull request as ready for review December 18, 2025 06:53
Add ContentDebouncer that adjusts debounce delay based on previous
parse/render time for each file:

- Debounce = parse_time * 2.0 (clamped to 5-500ms range)
- Default: 20ms for files not yet parsed
- Max wait: 2000ms to ensure responsiveness

Slower files (larger/complex) get longer debounce to avoid overwhelming
the system, while faster files get quicker feedback.

The debouncer is shared between LSP backend and WebSocket handler to
track parse times across the system.
Add handle_live_file_change_lightweight() that only broadcasts content
without recalculating backlinks and two-hop links. This significantly
reduces CPU overhead for large files (~9000 lines) during rapid typing.

The full link calculation (handle_live_file_change) is still available
for use after idle periods or on file save.
- First keystroke → flush immediately, update last_flush_at
- Subsequent keystrokes within debounce period → update pending text, schedule ONE timer (only on first pending)
- Timer fires → flush latest text (whatever was last typed), clear pending
- Next keystroke after timer fires → if debounce period passed, flush immediately again
@ompugao ompugao force-pushed the feat/debounce_preview branch from 5b7c4cd to 2f21135 Compare December 30, 2025 08:40
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