Repository navigation
Fix JS extractor line numbers being off on CRLF files - #1288
Merged
akx merged 2 commits intoOct 30, 2026
Merged
Conversation
apoorva-01
force-pushed
the
fix/770-crlf-jslexer-line-numbers
branch
from
July 2, 2026 02:51
23bcec7 to
c1e2875
Compare
The // and <!-- comment rules matched with .*, which eats the \r of a CRLF, so the comment kept a trailing \r counted as a newline (and the \n again). Restrict both to [^\r\n] so the pair counts once.
akx
force-pushed
the
fix/770-crlf-jslexer-line-numbers
branch
from
October 30, 2026 09:15
c1e2875 to
9e49025
Compare
akx
self-requested a review
October 30, 2026 09:15
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1288 +/- ##
==========================================
+ Coverage 93.53% 93.54% +0.01%
==========================================
Files 27 27
Lines 4931 4930 -1
==========================================
Hits 4612 4612
+ Misses 319 318 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
|
Could you rebase this to fix conflicts? |
akx
approved these changes
Oct 30, 2026
akx
left a comment
Member
There was a problem hiding this comment.
I simplified the test cases a bit. Thank you.
akx
enabled auto-merge (squash)
October 30, 2026 10:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #770.
The JS extractor reports different line numbers by line ending: a call after three comment lines shows on line 4 with LF but line 7 with CRLF.
It's the
//and<!--comment rules in jslexer. They match with.*, and.eats the\rof a CRLF, so the comment token keeps a trailing\rthat gets counted as a newline, then the\nis counted again, two lines per comment. Switching both to[^\r\n]*stops the comment before the newline so the\r\ncounts once. Added tests that LF and CRLF line numbers match.Left
CHANGES.rstalone since that's filled in at release, happy to add an entry.