ricardofbarros / linter-js-standard

Atom linter plugin for JavaScript, using JavaScript Standard Style
https://atom.io/packages/linter-js-standard
MIT License
99 stars 48 forks source link

Uncaught Error: Column start (20) greater than line length (19) for line 268 #200

Closed joshuamackin closed 7 years ago

joshuamackin commented 7 years ago

[Enter steps to reproduce:]

  1. Was just typing.
  2. Error popped.
  3. Made vague issue :|

Atom: 1.19.4 x64 Electron: 1.6.9 OS: Mac OS X 10.12.6 Thrown From: linter-js-standard package 4.0.0

Stack Trace

Uncaught Error: Column start (20) greater than line length (19) for line 268

At /Users/jmackin/.atom/packages/linter-js-standard/node_modules/atom-linter/lib/index.js:181

Error: Column start (20) greater than line length (19) for line 268
    at generateRange (/packages/linter-js-standard/node_modules/atom-linter/lib/index.js:181:11)
    at getRange (/packages/linter-js-standard/lib/utils/linter.js:16:10)
    at /packages/linter-js-standard/lib/utils/linter.js:39:19
    at Array.forEach (native)
    at Object.module.exports (/packages/linter-js-standard/lib/utils/linter.js:29:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Commands

     -2:15.2.0 editor:newline (input.hidden-input)
     -2:14.2.0 core:paste (input.hidden-input)
  3x -2:08.8.0 core:save (input.hidden-input)
     -0:34.4.0 core:undo (input.hidden-input)
     -0:31.1.0 core:save (input.hidden-input)
     -0:29.7.0 core:copy (input.hidden-input)
     -0:24.9.0 core:paste (input.hidden-input)
  2x -0:24.6.0 core:save (input.hidden-input)
     -0:21.8.0 core:copy (input.hidden-input)
  2x -0:20.6.0 core:paste (input.hidden-input)
     -0:19.5.0 core:save (input.hidden-input)
     -0:17.4.0 editor:newline (input.hidden-input)
  3x -0:14.8.0 core:backspace (input.hidden-input)
     -0:12.9.0 editor:newline (input.hidden-input)
     -0:10.5.0 core:backspace (input.hidden-input)
     -0:09.3.0 core:save (input.hidden-input)

Non-Core Packages

angularjs 0.4.0 
atom-typescript 11.0.7 
autoclose-html 0.23.0 
busy-signal 1.4.3 
file-icons 2.1.11 
fonts 3.0.2 
intentions 1.1.5 
language-scala 1.1.9 
linter 2.2.0 
linter-js-standard 4.0.0 
linter-ui-default 1.6.8 
pigments 0.40.2 
platformio-ide-terminal 2.6.0 
Arcanemagus commented 7 years ago

@joshuamackin Do you happen to have a bit of code that you can share that triggers this? I've seen a report that comma-dangle might have issues, but the user hasn't responded with a way to reproduce it.

joshuamackin commented 7 years ago

Unfortunately I don't. Well I just don't remember exactly where it was to reproduce the bug.

Usually when the bug popup triggers, it says the bug was already reported so I wasn't quite ready when it wasn't reported.

Arcanemagus commented 7 years ago

That specific message means standard (eslint) reported a point for a message that doesn't actually exist in the document, which is a bug in the linter itself. If you can find a bit of code that reproduces it we can get that reported up to ESLint where it can be fixed for everybody 😉.

djake commented 7 years ago

In case it is helpful, I came here to note that this looks similar to a bug I got and reported in the wrong repo: https://github.com/AtomLinter/linter-eslint/issues/995.

Arcanemagus commented 7 years ago

Correct, it's the same mechanism detecting the invalid points, but without knowing what code triggered it it's impossible to know what is going on here.

sonicdoe commented 7 years ago

@joshuamackin @djake Can you share the standard version that your project is set up with? This might help to narrow down the issue.

hutch120 commented 7 years ago

@Arcanemagus @sonicdoe I think I've figured out how to reproduce this issue.

Create a new .js file and add at least a few thousand lines of code, and save the file. e.g.:

var test = 'test'
var test = 'test'
... copy at least 4000 thousand times.

Then pick the end of a line, press enter (to create a new empty line), and then press backspace (to clear the empty line) in fairly quick succession. I sometimes have to do it a couple of times to trigger the exception.

sonicdoe commented 7 years ago

It sounds like by the time standard.lintText() has finished, the editor’s contents have already changed. This causes textEditor.getBuffer() in atom-linter to return a different buffer than the one standard was running against.

Arcanemagus commented 7 years ago

@sonicdoe Minor point of clarification: Same TextBuffer, different contents 😉.

It's certainly a possibility, in many of the other providers we grab the contents before a lint, and then check that they haven't changed after the actual linter (standard) finishes its run, if they change null is returned telling linter not to update the messages.

sonicdoe commented 7 years ago

This issue should be fixed in v4.0.1. Let me know if you’re still running into similar errors.

sonicdoe commented 7 years ago

In retrospect, my fix was a bit short-sighted since it runs after atom-linter’s getRange(). I’ll try to (actually) fix this as soon as possible.

sonicdoe commented 7 years ago

This should now actually be fixed in v4.0.2.