fix: prevent color decoration flicker by fixing CSS class lifecycle#304988
Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: prevent color decoration flicker by fixing CSS class lifecycle#304988yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
Conversation
When color decorations are recomputed (e.g. after deleting text), the old CSS class references were cleared before new decorations were set. This caused a brief flash where existing decorations lost their background colors. Fix by building new CSS class refs into a separate DisposableStore, applying the new decorations first, then disposing the old CSS classes. This ensures decorations always have valid CSS classes. Closes microsoft#235912
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.
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
When color decorations are recomputed (e.g. after editing text that contains color values), there is a visible flicker. The old CSS class references are disposed before new decorations replace them, causing a frame where existing decorations lose their background color styling.
Closes #235912
What is the new behavior?
New CSS class refs are built into a separate DisposableStore while the old CSS classes remain active. New decorations are applied first, then old CSS classes are disposed. This ensures decorations always have valid CSS classes.
Additional context
ColorDetector.updateColorDecorators()insrc/vs/editor/contrib/colorPicker/browser/colorDetector.ts_colorDecorationClassRefschanged fromreadonlyto mutable to support swapping the disposable storeremoveAllDecorations()is unchanged since it intentionally removes everything at once