steelbrain / linter

A Base Linter with Cow Powers http://steelbrain.me/linter/
MIT License
1.1k stars 178 forks source link

Uncaught TypeError: Cannot read property 'setAttribute' of null #912

Closed TimoWilken closed 9 years ago

TimoWilken commented 9 years ago

Probably related to #911.

Steps to reproduce

  1. switch to .json file with JSON linter package enabled (in my case, this was not a package.json like in #911)
    • on editing the same or any other JSON file further, the error does not reappear until restarting atom
    • when restarting atom, the error appears immediately on startup when the cursor is in a JSON file on startup
  2. type one character (" in my case)
  3. error message popup appears (see below)

Atom Version: 1.0.19; installed just beforehand via rpm -U, no problems in previous installed version (1.0.9, I think) System: Fedora 22, x86_64, Linux 4.1.7 Thrown From: linter package, v1.7.0

Stack Trace

Uncaught TypeError: Cannot read property 'setAttribute' of null

At /home/timo/.atom/packages/linter/lib/ui/message-element.js:21

TypeError: Cannot read property 'setAttribute' of null
  at linter-message.updateVisibility (/home/timo/.atom/packages/linter/lib/ui/message-element.js:41:209)
  at BottomPanel.setMessages (/home/timo/.atom/packages/linter/lib/ui/bottom-panel.js:56:24)
  at LinterViews.render (/home/timo/.atom/packages/linter/lib/linter-views.coffee:36:12)
  at /home/timo/.atom/packages/linter/lib/linter.coffee:29:14
  at Emitter.module.exports.Emitter.emit (/usr/share/atom/resources/app.asar/node_modules/event-kit/lib/emitter.js:82:11)
  at MessageRegistry.updatePublic (/home/timo/.atom/packages/linter/lib/message-registry.js:116:20)
  at UpdateMessages (/home/timo/.atom/packages/linter/lib/message-registry.js:42:17)

Commands

     -0:56.8.0 core:move-right (atom-text-editor.editor.is-focused.autocomplete-active)
  4x -0:56.5.0 editor:select-to-beginning-of-word (atom-text-editor.editor.is-focused)
  3x -0:55.4.0 core:select-left (atom-text-editor.editor.is-focused)
     -0:54.5.0 core:delete (atom-text-editor.editor.is-focused)
     -0:54 editor:move-to-beginning-of-word (atom-text-editor.editor.is-focused)
     -0:53.8.0 core:save (atom-text-editor.editor.is-focused)
  2x -0:22.7.0 editor:move-to-beginning-of-word (atom-text-editor.editor.is-focused)
     -0:21.9.0 core:move-right (atom-text-editor.editor.is-focused)
  2x -0:21.5.0 editor:select-to-beginning-of-word (atom-text-editor.editor.is-focused)
     -0:20.5.0 core:select-left (atom-text-editor.editor.is-focused)
  2x -0:19 core:delete (atom-text-editor.editor.is-focused)
     -0:18.3.0 editor:move-to-end-of-screen-line (atom-text-editor.editor.is-focused)
     -0:17.8.0 core:backspace (atom-text-editor.editor.is-focused)
  3x -0:17.2.0 core:move-left (atom-text-editor.editor.is-focused)
     -0:16.5.0 core:save (atom-text-editor.editor.is-focused)
     -0:01.7.0 core:move-left (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "preview-inline",
      "python-isort",
      "atom-save-all",
      "open-html-in-browser",
      "python-iresolve",
      "indent-guide-improved",
      "live-doc-viewer"
    ],
    "destroyEmptyPanes": false,
    "openEmptyEditorOnStart": false,
    "themes": ["atom-material-ui", "one-dark-syntax"]
  },
  "linter": {"showErrorPanel": false}
}

Installed Packages

# User
atom-beautify, v0.28.14
atom-html-preview, v0.1.11
atom-jinja2, v0.5.0
atom-material-ui, v0.6.1
atom-smart-tabs, v0.1.0
autoclose-html, v0.19.0
autocomplete-bibtex, v0.6.1
autocomplete-haskell, v0.5.1
autocomplete-html-entities, v0.1.0
autocomplete-paths, v1.0.2
autocomplete-php, v0.3.7
autocomplete-python, v0.5.4
autocomplete-ruby, v0.1.0
color-picker, v2.0.12
colorful-json, v1.0.0
compare-files, v0.6.2
emmet, v2.3.13
emmet-snippets-compatibility, v1.0.0
fonts, v0.6.0
haskell-ghc-mod, v0.9.12
ide-haskell, v0.7.2
indentation-indicator, v0.6.0
language-diff, v0.3.1
language-haskell, v1.4.9
language-latex, v0.6.1
language-z80asm, v0.34.0
latex, v0.25.1
latexer, v0.2.7
linter, v1.7.0
linter-chktex, v1.1.0
linter-csslint, v1.0.6
linter-htmlhint, v0.1.1
linter-js-yaml, v1.1.2
linter-jsonlint, v1.0.1
linter-python-pep257, v0.0.1
linter-python-pep8, v0.2.0
minimap-git-diff, v4.1.8
mixed-indent-warning, v0.2.0
pdf-view, v0.27.0
pretty-json, v0.4.1
python-autopep8, v0.1.3
python-tools, v0.6.5

# Dev
No dev packages
steelbrain commented 9 years ago

Restart the editor and let me know if this happens again

thibault-ml commented 9 years ago

I do have this issue happen from time to time. I have to restart the editor for the linter to work again, but the error still pops up at times.

steelbrain commented 9 years ago

I have been running master for weeks, didn't get this error, I'll try to repro

thibault-ml commented 9 years ago

Here's what my report if that helps:

Atom Version: 1.0.19 System: Mac OS X 10.10.5 Thrown From: linter package, v1.7.0

Stack Trace

Uncaught TypeError: Cannot read property 'setAttribute' of null

At /Users/thibault.ml/.atom/packages/linter/lib/ui/message-element.js:21

TypeError: Cannot read property 'setAttribute' of null
    at linter-message.updateVisibility (/Users/thibault.ml/.atom/packages/linter/lib/ui/message-element.js:21:59)
    at BottomPanel.setMessages (/Users/thibault.ml/.atom/packages/linter/lib/ui/bottom-panel.js:36:22)
    at LinterViews.render (/Users/thibault.ml/.atom/packages/linter/lib/linter-views.coffee:36:12)
    at /Users/thibault.ml/.atom/packages/linter/lib/linter.coffee:29:14
    at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:82:11)
    at MessageRegistry.updatePublic (/Users/thibault.ml/.atom/packages/linter/lib/message-registry.js:86:18)
    at UpdateMessages (/Users/thibault.ml/.atom/packages/linter/lib/message-registry.js:31:16)

Commands

     -0:01.5.0 core:save (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "themes": [
      "flatland-dark-ui",
      "flatland-dark"
    ],
    "openEmptyEditorOnStart": false
  },
  "linter": {}
}

Installed Packages

# User
build, v0.47.0
build-cargo, v0.2.0
flatland-dark, v0.1.6
flatland-dark-ui, v0.2.4
language-rust, v0.4.5
linter, v1.7.0
linter-clang, v3.2.3
linter-erb, v0.1.1
linter-pep8, v1.0.1
linter-rust, v0.2.9
minimap, v4.13.4
racer, v0.17.2

# Dev
No dev packages
thibault-ml commented 9 years ago
screen shot 2015-09-30 at 23 50 28

I have very little knowledge of JS, none of the linter or CoffeeScript, but looking at the source code, I believe the second line of this screenshot might be the problem. It's trying to get linter-message-link, but there is no link associated with that error. If I comment the code that generates that error, then the error doesn't appear. If I uncomment the code that generates that error, then I do get that error.

thibault-ml commented 9 years ago

Here's the actual compiler issue:

src/main.rs:3:24: 3:27 warning: unused import, #[warn(unused_imports)] on by default
src/main.rs:3 use std::sync::{Mutex, Arc};
                                     ^~~
src/main.rs:9:1: 11:2 warning: struct is never used: `Table`, #[warn(dead_code)] on by default
src/main.rs: 9 struct Table {
src/main.rs:10     forks: Vec<Mutex<()>>,
src/main.rs:11 } 
src/main.rs:10:5: 10:26 warning: struct field is never used: `forks`, #[warn(dead_code)] on by default
src/main.rs:10     forks: Vec<Mutex<()>>,
                   ^~~~~~~~~~~~~~~~~~~~~

I believe linter-rust groups the last two errors as one, which is probably why the line/column link is not displayed. I would say that while the rust linter is the one grouping them, linter is still at fault as it should not error because of the absence of link.

steelbrain commented 9 years ago

I have a fix up for this

steelbrain commented 9 years ago

A patch release is up for download.

thibault-ml commented 9 years ago

Thanks, that was quick :-) I see my assumption was the right one!

steelbrain commented 9 years ago

@naixn Yes it was sir :)

steelbrain commented 9 years ago

Also fixing the scenario where multi line messages don't have a link when they should.