Incorrect line number reported when file has LF for line separator
See original GitHub issueSimilarly to #37 I now find that under some conditions the line number is incorrect when the file uses LF for line separators. Specifically, it again appears related to single-line comments, this time, being out by -1 for every SLC which is followed by at least one blank line. In the examples following, there is a missing =
in the function’s variable assignment.
Out by -4:
0001 // Single line comment
0002
0003 // Single line comment
0004
0005 // Single line comment
0006
0007 // Single line comment
0008
0009 function handleAutocomplete() {
0010 var prp this.props; // <= error on this line
0011
0012 for(let xa=0; xa<100; xa++) {;}
0013 }
ERROR : C:/Data/user/lawrence/programming/build/esvalidate/test-lf.js:~: [6:41]: Unexpected token: 'this'
Out by -3:
0001 // Single line comment
0002
0003 // Single line comment
0004
0005 // Single line comment
0006
0007 function handleAutocomplete() {
0008 var prp this.props; // <= error on this line
0009
0010 for(let xa=0; xa<100; xa++) {;}
0011 }
ERROR : C:/Data/user/lawrence/programming/build/esvalidate/test-lf.js:~: [5:41]: Unexpected token: 'this'
and so on.
This does not happen for CRLF line endings. I can induce any syntax error in a file with SLC’s and it is consistently misreported.
Issue Analytics
- State:
- Created 4 years ago
- Comments:37 (36 by maintainers)
Top Results From Across the Web
How to Get Consistent Line Breaks in vs Code (LF vs CRLF)
At the bottom right of the screen in VS Code, click the little button that says LF or CRLF . After changing it...
Read more >How to Get Consistent Line Breaks in VS Code (LF vs CRLF)
At the bottom right of the screen in VS Code there is a little button that says “LF” or “CRLF”: Click that button...
Read more >Forcing CRLF line separator in my project - maven
Navigate to File -> Settings -> Editor -> Code Style and specify the default line separator by selecting Windows (\r\n) from the Line...
Read more >Fixing misaligned Linux and Windows line endings
Specifically, I am running Microsoft SQL Server in a container in a Kubernetes cluster—okay, it's Red Hat OpenShift, but it's still Kubernetes.
Read more >How to Ensure Always LF not CRLF on Windows
Let's try to reproduce this on an empty project. Please create one, set the line separator to \n, restart PhpStorm and create a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Take your time 😃 Do it if and when you can. I have some huge critical RL issues to handle now so I have no time for anything anymore it seems.
cc / @nchanged
Apologies for not commenting, but yes, I tested this as soon as it landed and confirmed correct reporting in my two test files. When I came back here it was closed, so I figured we were good. Appreciate you checking up on it.