lee-dohm / indentation-indicator

Atom package that adds an indicator to the status bar that shows the indentation width and type of the active editor.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Warning and failed language highlighting

ricardograca opened this issue · comments

With indentation-indicator enabled I get this on the console when starting up:

Failed to load grammar: /usr/share/atom/resources/app/node_modules/language-javascript/grammars/javascript.json TypeError: Cannot read property 'update' of null
  at /home/ricardo/.atom/packages/indentation-indicator/lib/indentation-indicator.coffee:32:14
  at Emitter.module.exports.Emitter.emit (/usr/share/atom/resources/app/node_modules/event-kit/lib/emitter.js:82:11)
  at TextEditor.module.exports.TextEditor.handleGrammarChange (/usr/share/atom/resources/app/src/text-editor.js:2787:27)
  at /usr/share/atom/resources/app/src/text-editor.js:196:24
  at Emitter.module.exports.Emitter.emit (/usr/share/atom/resources/app/node_modules/event-kit/lib/emitter.js:82:11)
  at TokenizedBuffer.module.exports.TokenizedBuffer.setGrammar (/usr/share/atom/resources/app/src/tokenized-buffer.js:168:27)
  at TokenizedBuffer.module.exports.TokenizedBuffer.grammarAddedOrUpdated (/usr/share/atom/resources/app/src/tokenized-buffer.js:124:23)
  at /usr/share/atom/resources/app/src/tokenized-buffer.js:3:61
  at Emitter.module.exports.Emitter.emit (/usr/share/atom/resources/app/node_modules/event-kit/lib/emitter.js:82:11)
  at GrammarRegistry.module.exports.GrammarRegistry.addGrammar (/usr/share/atom/resources/app/node_modules/first-mate/lib/grammar-registry.js:84:20)
  at Grammar.module.exports.Grammar.activate (/usr/share/atom/resources/app/node_modules/first-mate/lib/grammar.js:176:48)
  at /usr/share/atom/resources/app/src/package.js:469:25
  at /usr/share/atom/resources/app/node_modules/first-mate/lib/grammar-registry.js:129:55
  at parseContents (/usr/share/atom/resources/app/node_modules/season/lib/cson.js:80:47)
  at /usr/share/atom/resources/app/node_modules/season/lib/cson.js:168:20
  at fs.js:295:14
  at Object.oncomplete (fs.js:93:15)

This causes the affected files to not have any syntax highlighting since they are incorrectly detected as Plain Text.

Apparently this seems to be some kind of bad interaction with the package open-last-project, since the lack of syntax coloring only affects files that are already open when starting Atom. Newly opened files after that are not affected. I'll also open an issue over there to see if you guys can figure this out.

Atom version is 0.175.0.

It appears that with open-last-project installed, an editor is created and its grammar changed before all packages have been activated. I'll just add a guard for undefined and at least the error should go away. I'm not sure if the indentation indicator will show the right values in that instance though.

It probably won't, judging from what happens now. I get no syntax highlighting and no indentation indication when this error happens, but I can live with that (no indentation indication that is).

I'll have a new version up shortly. Let me know what happens.

Update to v0.4.1 and let me know if the indicator shows the right info.

Wow! Everything is working perfectly fine now :) No errors on the console, all previously opened files display correctly and even have the correct indentation indication. I really wouldn't like to work without this package. Many thanks 👍

You're welcome! I'm glad you enjoy it 😀