halohalospecial / atom-elmjutsu

A bag of tricks for developing with Elm. (Atom package)
https://atom.io/packages/elmjutsu
MIT License
192 stars 24 forks source link

Uncaught TypeError: Cannot read property '1' of null #114

Closed kaskelotti closed 6 years ago

kaskelotti commented 6 years ago

[Enter steps to reproduce:]

  1. Create an Elm source file that starts with multiline comment block {- -}
  2. Use arrow keys to navigate back and forth the comment block

Using single line comments -- works fine. Also, making any kind of syntax error on the source file seems to trigger this error.

Atom: 1.25.0 ia32 Electron: 1.7.11 OS: Microsoft Windows 10 Enterprise Thrown From: elmjutsu package 7.2.2

Stack Trace

Uncaught TypeError: Cannot read property '1' of null

At xxxx\.atom\packages\elmjutsu\lib\helper.js:249

TypeError: Cannot read property '1' of null
    at /packages/elmjutsu/lib/helper.js:249:44
    at TextBuffer.module.exports.TextBuffer.scanInRange (~/AppData/Local/atom/app-1.25.0/resources/app/node_modules/text-buffer/lib/text-buffer.js:1097:15)
    at TextEditor.scanInBufferRange (~/AppData/Local/atom/app-1.25.0/resources/app/src/text-editor.js:3378:73)
    at /packages/elmjutsu/lib/helper.js:241:16
    at Object.getActiveTopLevel (/packages/elmjutsu/lib/helper.js:254:31)
    at Object.sendActiveToken (/packages/elmjutsu/lib/indexing.js:89:14)
    at /packages/elmjutsu/lib/core.js:193:32

Commands

  4x -1:58.6.0 core:move-down (input.hidden-input)
     -1:56.5.0 editor:consolidate-selections (input.hidden-input)
     -1:56.5.0 core:cancel (input.hidden-input)
  6x -1:56.1.0 core:move-down (input.hidden-input)
     -1:53.7.0 editor:consolidate-selections (input.hidden-input)
     -1:53.7.0 core:cancel (input.hidden-input)
  2x -1:52.7.0 core:move-down (input.hidden-input)
     -0:46.3.0 editor:consolidate-selections (input.hidden-input)
     -0:46.3.0 core:cancel (input.hidden-input)
     -0:45.5.0 core:move-down (input.hidden-input)
     -0:40.7.0 editor:consolidate-selections (input.hidden-input)
     -0:40.7.0 core:cancel (input.hidden-input)
     -0:39 intentions:highlight (input.hidden-input)
     -0:38.7.0 settings-view:open (input.hidden-input)
     -0:24.7.0 core:close (div.panels-item)
  2x -0:23.3.0 core:move-down (input.hidden-input)

Non-Core Packages

atom-beautify 0.32.2 
busy-signal 1.4.3 
cucumber 0.6.0 
elmjutsu 7.2.2 
highlight-selected 0.13.1 
intentions 1.1.5 
jshint 1.8.6 
language-asp 1.1.1 
language-elm 1.5.0 
language-sln 0.1.0 
language-vb 0.1.0-pre1 
linter 2.2.0 
linter-eslint 8.4.1 
linter-ui-default 1.7.1 
minimap 4.29.8 
minimap-find-and-replace 4.5.2 
minimap-highlight-selected 4.6.1 
project-manager 3.3.5 
SidneyNemzer commented 6 years ago

I'm also getting this error. Just started happening today. I've used elmjutsu in this project for a week and I haven't run into this. Possible related to the recent update to atom-ide-ui? That's the only change in my dev environment I can think of. Tried downgrading to atom-ide-ui 0.9.2 (which is two versions old), still have the same error

Also, making any kind of syntax error on the source file seems to trigger this error.

That seems to be part of the cause. The multiline / single comment at top of the file... that would be a syntax error, right? Because the compiler is looking for a module definition? Maybe this error is not really related to comments, rather just any syntax errors?

EDIT Doesn't seem to happen on just any syntax errors. It seems to be somehow related to some of the union types in one of my Elm modules? I haven't pinned down exactly what causes it though.

EDIT 2 Hopefully, this issue is easy for the developers to solve. For now, since it was really anoying getting this error after every letter, I manually modified the package's file, /packages/elmjutsu/lib/helper.js, line 249. I simply added a check to that if statement to make sure match was truthy before accessing match like it was an array. This line, for anyone that's keeping track.

halohalospecial commented 6 years ago

@kaskelotti, @SidneyNemzer, I could not replicate it :cry: Can you give me example code? Thanks!

kaskelotti commented 6 years ago

Neither could I. I made a brand new elm file for this, but could not reproduce. My project file had this issue, but I cannot share that openly. After the latest elmjutsu update to version 7.2.6 the issues seems to be fixed.

I'll close this issue.