Skip to content

Retokenize on custom font token setting change#287577

Merged
aiday-mar merged 3 commits intomainfrom
critical-peafowl
Jan 14, 2026
Merged

Retokenize on custom font token setting change#287577
aiday-mar merged 3 commits intomainfrom
critical-peafowl

Conversation

@aiday-mar
Copy link
Contributor

fixes #286154
fixes #284684

Copilot AI review requested due to automatic review settings January 13, 2026 16:40
@aiday-mar aiday-mar self-assigned this Jan 13, 2026
@aiday-mar aiday-mar requested a review from alexdima January 13, 2026 16:41
@aiday-mar aiday-mar marked this pull request as ready for review January 13, 2026 16:41
@aiday-mar aiday-mar enabled auto-merge (squash) January 13, 2026 16:41
@vs-code-engineering vs-code-engineering bot added this to the January 2026 milestone Jan 13, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issues where changes to custom font token settings in editor.tokenColorCustomizations were not triggering retokenization in the editor. The fix ensures that when font-related properties (fontFamily, fontSize, lineHeight) are modified in token color customizations, both the main thread and worker thread tokenizers are properly updated and retokenize the content.

Changes:

  • Extended token rule comparison to include font-related properties
  • Added worker thread notification mechanism for custom token rule changes
  • Implemented retokenization trigger in worker tokenizer when custom rules change

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/vs/workbench/services/textMate/browser/textMateTokenizationFeatureImpl.ts Extended equalsTokenRules function to compare font properties (lineHeight, fontSize, fontFamily) in addition to existing properties
src/vs/workbench/services/textMate/browser/backgroundTokenization/worker/textMateWorkerTokenizer.ts Added onTextmateCustomRulesChanged method to trigger tokenization reset when custom rules change
src/vs/workbench/services/textMate/browser/backgroundTokenization/worker/textMateTokenizationWorker.worker.ts Added $acceptTextmateCustomRulesChanged method to handle custom rule changes and forward to the appropriate model
src/vs/workbench/services/textMate/browser/backgroundTokenization/textMateWorkerTokenizerController.ts Added configuration change listener for editor.tokenColorCustomizations to notify the worker when changes occur

const s2 = r2.settings;
if (s1 && s2) {
if (s1.fontStyle !== s2.fontStyle || s1.foreground !== s2.foreground || s1.background !== s2.background) {
if (s1.fontStyle !== s2.fontStyle || s1.foreground !== s2.foreground || s1.background !== s2.background || s1.lineHeight !== s2.lineHeight || s1.fontSize !== s2.fontSize || s1.fontFamily !== s2.fontFamily) {
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line added to check font-related properties (lineHeight, fontSize, fontFamily) is very long and violates readability guidelines. Consider breaking this into multiple comparisons or extracting into a helper function for better maintainability.

Copilot uses AI. Check for mistakes.
Copy link
Member

@alexdima alexdima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem like the right way to do this. IMHO this should be refreshed in the same way a color change or a rule change for syntax colors causes a refresh.

@aiday-mar aiday-mar requested a review from alexdima January 14, 2026 10:47
Copy link
Member

@alexdima alexdima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@aiday-mar aiday-mar merged commit c8f9f77 into main Jan 14, 2026
22 checks passed
@aiday-mar aiday-mar deleted the critical-peafowl branch January 14, 2026 13:36
eli-w-king pushed a commit that referenced this pull request Jan 14, 2026
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.

Font size does not apply in custom token customization font token customization: reload for changes to take effect

3 participants