Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Problem

When useInlineStyles={false} is enabled in react-syntax-highlighter, the library outputs CSS class names (.token.keyword, .token.string, etc.) instead of computing inline styles at runtime. This reduces JavaScript overhead, but requires actual CSS stylesheets to be loaded.

Solution

  • Generated prism-syntax.css from vscDarkPlus theme with backgrounds removed
  • Imported CSS in DiffRenderer.tsx where syntax highlighting is used
  • CSS classes now available when useInlineStyles={false} prop is active

Testing

  • ✅ All 661 tests pass
  • ✅ TypeScript compilation successful
  • Manual testing: Verify syntax highlighting still works in Review tab

Related

  • Builds on commit 1397430 which added useInlineStyles={false} prop
  • Part of Review tab performance optimization work

Generated with cmux

Set useInlineStyles={false} in react-syntax-highlighter to reduce
JavaScript computation overhead by using CSS classes instead of
computing style objects at runtime.

This is a simple performance optimization that offloads styling work
from JS to CSS. If highlighting is still slow, we can explore more
aggressive optimizations like viewport-based rendering.

Generated with `cmux`
When useInlineStyles={false}, react-syntax-highlighter outputs CSS class names
(.token.keyword, .token.string, etc.) instead of computing inline styles. This
CSS file provides the actual styling rules.

Generated from vscDarkPlus theme with backgrounds removed to preserve diff
background colors in the Review tab.
- Created scripts/generate_prism_css.ts to generate CSS from vscDarkPlus theme
- Filters out font-family and font-size to inherit from parent (DiffContainer)
- Preserves project font standards: var(--font-monospace) and 12px default
- Updated CSS with regeneration instructions
@ammario ammario merged commit 0585010 into main Oct 19, 2025
8 checks passed
@ammario ammario deleted the optimize-review-syntax-highlighting branch October 19, 2025 18:28
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.

2 participants