Repository navigation
perf(editor): update highlighters once at the end of a theme transition - #1402
Merged
Merged
Conversation
QueryaThemeScope now says whether its theme is a mid-animation frame (AnimatedQueryaTheme sets it while the controller runs). QueryaCodeEditor skips highlighter updates for those frames and applies the final theme once, so a transition no longer builds a highlighter pair per frame or fills the pair cache with transient colours. Closes #1358.
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1358
State of the issue
Points 1 and 2 (do not dispose / recreate
QueryaHighlightControlleron each frame, update it in place) were already covered by the controller lifecycle refactor (#1366): the editor now callscontroller.updateTheme. What was left is point 3 and the per-frame cost: during a transitionQueryaTheme.lerphands the editor a differenteditortheme every frame, so each frame ranSyntaxHighlightService.createPairwith transient colours: a cache miss, a new highlighter pair, and eviction of real entries from the 12-slot cache.Change
QueryaThemeScope.transitioning(defaultfalse) andQueryaThemeScope.isTransitioning(context);updateShouldNotifyalso fires when the flag flips.AnimatedQueryaThemesetstransitioning: animation.isAnimating.QueryaCodeEditor._syncThemeIfNeededignores mid-transition frames (once it has an initial theme) and applies the final theme once, whentransitioningbecomes false.Behaviour note
While a transition runs the token colours stay on the old theme and switch once at the end of the 200-300 ms; the editor's base text colour and chrome still interpolate.
Tests
animated_querya_theme_transition_test.dart: the flag is false at rest, true mid-animation, false after, consumers are rebuilt when it ends, and plain scopes default to settled.Not run locally; CI is the check.