-
Notifications
You must be signed in to change notification settings - Fork 87
Open
Description
Summary
When enabling the “Show whitespace and tab characters” option, syntax highlighting stops working correctly for .c and .cc files.
This issue starts appearing in v3.3.1 and persists in higher versions. It works fine in v2.4.1.
Steps to Reproduce
- Use react-diff-view v3.3.1 or later
- Load a diff containing .c or .cc files.
- Enable Show whitespace and tab characters.
- Observe that syntax highlighting disappears or becomes inconsistent.
Expected Behavior
Syntax highlighting should remain functional even when whitespace and tab characters are shown.
Actual Behavior
When the whitespace view is enabled, the new tokenization merges whitespace into syntax tokens, breaking syntax highlighting for .c and .cc files.
Notes
- Not reproducible in v2.4.1.
- The regression is likely related to the new tokenization system introduced in v3.3.1.
- Simpler file types (like .js, .py) are unaffected.
- Consistently reproducible on Chrome (latest).
Environment
- react-diff-view: v3.3.1 and above
- Browser: Chrome (latest)
- Affected file types: .c, .cc
- OS: macOS / Windows
Suggested Action
Review the whitespace tokenization logic introduced in v3.3.1.
Consider separating whitespace visualization from syntax token merging to restore proper highlighting for C/C++ grammars.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels