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
{{ message }}
Repository navigation
perf(editor): eliminate syntax highlight flicker and fallback to plain text on documents >= 8KB in QueryaHighlightController #1351
In lib/core/editor/querya_highlight_controller.dart (lines 40–82):
When editing documents where text.length >= kSyntaxHighlightIsolateThreshold (8192 characters / ~200 lines of SQL):
On each keystroke, buildTextSpan checks: if (_cachedSpan != null && _cachedText == text)
Because the user just typed a character, text changed and _cachedText == text is false.
The method falls through to: return TextSpan(style: style, text: text);
which returns completely unhighlighted, plain monochrome text.
Then _debounceTimer waits 100 ms (kSyntaxHighlightDebounce), launches the isolate highlight job, and once completed, updates _cachedSpan and calls notifyListeners().
As a result, while typing in any script >= 8 KB, the entire editor visibly flashes to monochrome plain text on every keystroke, and only flashes back to highlighted colors 100+ ms after the user pauses typing. If the user types continuously, all syntax highlighting is completely lost during typing.
Proposed Solution
Preserve _cachedSpan during active typing while background isolate highlighting is in flight, rather than falling back to plain monochrome text.
Provide a lightweight local line-level patch or keep the stale highlight span until the new isolate result arrives.
Only update the active span once the worker isolate returns the new segments.
Acceptance Criteria
Typing in scripts >= 8 KB does not drop syntax highlighting or cause monochrome text flickering.
Syntax highlighting updates seamlessly once isolate worker returns updated spans.
Frame timing during typing remains within 60/120 Hz budget without jank.
Resolved in #1458 by introducing delta segment patching (patchHighlightSegments) during active typing in documents >= 8KB in QueryaHighlightController, preserving syntax colors without dropping to monochrome text while background isolate highlighting is in flight.
Activity
Merge pull request #1458 from QueryaHub/issue/1351-highlight-flicker-…
ZhuchkaTriplesix commentedon Oct 11, 2026
Resolved in #1458 by introducing delta segment patching (patchHighlightSegments) during active typing in documents >= 8KB in QueryaHighlightController, preserving syntax colors without dropping to monochrome text while background isolate highlighting is in flight.