question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect line number reported when file has LF for line separator

See original GitHub issue

Similarly 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:closed
  • Created 4 years ago
  • Comments:37 (36 by maintainers)

github_iconTop GitHub Comments

2reactions
KFlashcommented, Oct 7, 2019

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

0reactions
lawrence-dolcommented, Oct 24, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found