Skip to content

fix(ace-editor): carry token classes onto emoji boxes#41821

Merged
rusackas merged 1 commit into
masterfrom
fix/ace-emoji-token-classes
Jul 7, 2026
Merged

fix(ace-editor): carry token classes onto emoji boxes#41821
rusackas merged 1 commit into
masterfrom
fix/ace-emoji-token-classes

Conversation

@rusackas

@rusackas rusackas commented Jul 6, 2026

Copy link
Copy Markdown
Member

SUMMARY

Follow-up to #41697, addressing a fair CodeAnt catch that landed after merge: the emoji width patch appends its forced-width .ace_cjk boxes directly to the line, outside the token-class wrapper ace puts around non-text tokens. Emoji glyphs carry their own color so the visible impact is small, but token styling that isn't glyph color — comment italics, ace_invalid backgrounds, and any theme's token-level styling — stopped applying to emoji segments inside those tokens.

Fix: mirror ace's text_util.isTextToken / $renderToken class construction directly on the emoji box (ace_cjk ace_constant ace_language for a constant.language token, bare ace_cjk for text tokens). Same cascade as ace's own nesting, no extra DOM.

Two new tests pin the class carrying for dotted token types and the bare-text case; emojiWidthPatch.ts stays at 100% coverage.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A — token-styling fidelity fix; caret behavior unchanged.

TESTING INSTRUCTIONS

cd superset-frontend && npx jest packages/superset-ui-core/src/components/AsyncAceEditor/emojiWidthPatch.test.ts

13 passed, 100% coverage on the patch module.

ADDITIONAL INFORMATION

🤖 Generated with Claude Code

Follow-up to #41697: the emoji spans were appended outside the
token-class wrapper ace puts around non-text tokens, so token styling
that isn't glyph color (comment italics, invalid-token backgrounds)
stopped applying to emoji segments. Mirror ace's text_util token-class
handling directly on the emoji box.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dosubot dosubot Bot added the change:frontend Requires changing the frontend label Jul 6, 2026
@bito-code-review

bito-code-review Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #066846

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 0f51c61..0f51c61
    • superset-frontend/packages/superset-ui-core/src/components/AsyncAceEditor/emojiWidthPatch.test.ts
    • superset-frontend/packages/superset-ui-core/src/components/AsyncAceEditor/emojiWidthPatch.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.76%. Comparing base (21b4185) to head (0f51c61).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #41821      +/-   ##
==========================================
- Coverage   64.77%   64.76%   -0.01%     
==========================================
  Files        2688     2688              
  Lines      148877   148881       +4     
  Branches    34359    34361       +2     
==========================================
- Hits        96428    96426       -2     
- Misses      50682    50688       +6     
  Partials     1767     1767              
Flag Coverage Δ
javascript 69.63% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aminghadersohi aminghadersohi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verified at HEAD 0f51c61: CI green (all required checks pass), no prior review threads to address. Confirmed the TEXT_TOKENS set and ace_+dotted-type class construction exactly mirror ace-builds' own text_util.isTextToken/$renderToken (checked against the vendored ace source), the two new tests exercise the real ace TextLayer (not a mock) and fail without the fix, no perf/XSS concerns (gated behind existing emoji match, classes come from the tokenizer not user text), and non-emoji tokens are unaffected. No findings.

@rusackas rusackas merged commit 101c1e8 into master Jul 7, 2026
69 checks passed
@rusackas rusackas deleted the fix/ace-emoji-token-classes branch July 7, 2026 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend packages size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants