jsc: preserve tabs in runtime error caret padding - #37540
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
WalkthroughThe error renderer now aligns carets with tabs and supplementary Unicode characters by using UTF-16 columns. Regression tests verify caret placement and process exit behavior. ChangesSource error caret alignment
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/js/bun/test/stack.test.ts`:
- Around line 88-107: Extend the test named “runtime error caret preserves tabs
before the error column (`#10857`)” with a supplementary-plane Unicode character
and a tab before error(). Assert the resulting source and caret lines, including
the expected UTF-16-width column alignment, so the cursor.c > 0xFFFF branch is
covered while preserving the existing stdout and exit behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 5ec99204-f2f6-455e-bbaf-940966701c5a
📒 Files selected for processing (2)
src/jsc/VirtualMachine.rstest/js/bun/test/stack.test.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/jsc/VirtualMachine.rs`:
- Around line 6032-6039: Update the padding loop near codepoints_written and
codepoint_width so codepoints_written advances by codepoint_width rather than a
fixed 1, preserving UTF-16 column accounting for supplementary code points while
retaining the existing tab and space output behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: e33788e5-71ba-4ca0-8038-1c58bff3f741
📒 Files selected for processing (2)
src/jsc/VirtualMachine.rstest/js/bun/test/stack.test.ts
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Summary
Root cause
Runtime error source lines retain literal tabs, but the caret prefix was rendered entirely as spaces. Terminals therefore expanded the source and caret prefixes differently, placing the caret several columns to the left.
The updated padding logic walks the displayed UTF-8 source by codepoint, emits tabs at their original logical positions, and emits two padding cells for supplementary-plane codepoints.
Testing
Fixes #10857