digitallyserviced / semanticolor

Provide Atom editor with semantic color highlighting.
https://atom.io/packages/semanticolor
MIT License
34 stars 3 forks source link

Uncaught TypeError: Cannot read property 'enabled' of undefined #23

Open smoline opened 7 years ago

smoline commented 7 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.16.0 x64 Electron: 1.3.13 OS: Mac OS X 10.12.4 Thrown From: semanticolor package 3.5.0

Stack Trace

Uncaught TypeError: Cannot read property 'enabled' of undefined

At /Users/sherilyn/.atom/packages/semanticolor/lib/semanticolor.js:195

TypeError: Cannot read property 'enabled' of undefined
    at createGrammar (/packages/semanticolor/lib/semanticolor.js:195:35)
    at /packages/semanticolor/lib/semanticolor.js:186:4
    at Function.module.exports.Emitter.simpleDispatch (/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/app.asar/node_modules/event-kit/lib/emitter.js:129:28)
    at GrammarRegistry.module.exports.GrammarRegistry.addGrammar (/app.asar/node_modules/first-mate/lib/grammar-registry.js:76:20)
    at Grammar.module.exports.Grammar.activate (/app.asar/node_modules/first-mate/lib/grammar.js:238:48)
    at /app.asar/src/package.js:618:25
    at /app.asar/node_modules/first-mate/lib/grammar-registry.js:121:55
    at parseContents (/app.asar/node_modules/season/lib/cson.js:119:7)
    at /app.asar/node_modules/season/lib/cson.js:208:20
    at ELECTRON_ASAR.js:493:9
    at FSReqWrap.wrapper [as oncomplete] (fs.js:681:17)

Commands

     -0:13.2.0 tree-view:show (atom-workspace.workspace.scrollbars-visible-when-scrolling.theme-vibrant-ink-ruby.theme-one-dark-ui)

Non-Core Packages

atom-beautify 0.29.23 
atom-bootstrap3 1.2.12 
atom-wrap-in-tag 0.6.0 
autocomplete-paths 1.0.5 
base-16-mexico-light-syntax-theme 0.0.1 
busy-signal 1.4.0 
color-picker 2.2.5 
docblockr 0.9.4 
emmet 2.4.3 
expand-region 0.2.7 
file-icons 2.1.3 
gemsource 0.3.0 
gl-light-syntax 2.2.0 
highlight-selected 0.13.1 
html2slim 0.4.1 
intentions 1.1.2 
language-slim 0.5.0 
linter 2.1.4 
linter-rubocop 2.1.1 
linter-stylelint 3.10.0 
linter-tidy 2.3.1 
linter-ui-default 1.2.3 
ocean-light-syntax 0.2.1 
pigments 0.39.1 
print-atom 0.1.1 
ruby-block 0.3.6 
semanticolor 3.5.0 
stylefmt 4.1.1 
terminal-plus 0.14.5 
theme-switcher 1.1.0 
toggle-quotes 1.0.1 
vibrant-ink-ruby 2.2.0 
sharedprophet commented 7 years ago

If you have a way to reproduce this, please try it with 3.5.1 and verify that it is fixed.

benpoole commented 7 years ago

I just updated the package in Atom, and restarted as requested. I then get this:

Atom: 1.16.0 x64 Electron: 1.3.13 OS: Mac OS X 10.12.4 Thrown From: semanticolor package 3.5.1

Stack Trace

Failed to activate the semanticolor package

At Cannot read property 'enabled' of undefined

TypeError: Cannot read property 'enabled' of undefined
    at createGrammar (/packages/semanticolor/lib/semanticolor.js:196:35)
    at Object.activate (/packages/semanticolor/lib/semanticolor.js:177:4)
    at Package.module.exports.Package.activateNow (/app.asar/src/package.js:218:19)
    at /app.asar/src/package.js:190:32
    at Package.module.exports.Package.measure (/app.asar/src/package.js:96:15)
    at /app.asar/src/package.js:183:26
    at Package.module.exports.Package.activate (/app.asar/src/package.js:180:34)
    at PackageManager.module.exports.PackageManager.activatePackage (/app.asar/src/package-manager.js:550:34)
    at /app.asar/src/package-manager.js:531:29
    at Config.module.exports.Config.transactAsync (/app.asar/src/config.js:337:18)
    at PackageManager.module.exports.PackageManager.activatePackages (/app.asar/src/package-manager.js:526:19)
    at PackageManager.module.exports.PackageManager.activate (/app.asar/src/package-manager.js:508:46)
    at /app.asar/src/atom-environment.js:826:28

Commands

     -0:00.7.0 core:copy (atom-notification.fatal.icon.icon-bug.native-key-bindings.has-detail.has-close.has-stack)

Non-Core Packages

atom-soda-dark-ui 1.1.0 
busy-signal 1.4.0 
color-picker 2.2.5 
dash 1.7.1 
git-history 3.3.0 
git-log 0.4.1 
intentions 1.1.2 
language-jade 0.7.2 
language-vb 0.1.0-pre1 
linter 2.1.4 
linter-csslint 1.3.4 
linter-eslint 8.1.6 
linter-htmlhint 1.3.3 
linter-javac 1.9.4 
linter-jsonlint 1.3.0 
linter-php 1.3.2 
linter-ruby 1.2.5 
linter-tidy 2.3.1 
linter-ui-default 1.2.3 
linter-xmllint 1.4.1 
merge-conflicts 1.4.4 
minimap 4.27.1 
minimap-linter 2.0.0 
semanticolor 3.5.1 
sort-lines 0.14.0 
title-case 0.4.0 
todo-show 1.11.0 
Zen 0.16.4 
sharedprophet commented 7 years ago

Please try 3.5.2 and see if that resolves the issue.

benpoole commented 7 years ago

Just updated, thank you. Subtly different now:

TypeError: Cannot read property 'enabled' of undefined
    at setTimeout (/Users/<ME>/.atom/packages/semanticolor/lib/semanticolor.js:198:

I then closed the (jade) file that was open at the time, and restarted Atom. Lo, the problem seems to have gone away, or at least I don't get the error (and any files I open have the semantic theme happening).

sharedprophet commented 7 years ago

Hmm, weird. Ok. I just fixed an issue with the previous fix that prevented semanticolor from being applied on files that are already open when Atom starts up, so you can update to 3.5.3 to get that. I think I will have to implement a better fix for this issue, though.

benpoole commented 7 years ago

3.5.3 is working OK for me, including when opening Atom where files were already open (i.e. restoring app state). Thanks!

smoline commented 7 years ago

I only received errors when upgrading, it appears I am on 3.5.3 and it is working.

smoline commented 7 years ago

now I got the error when I was installing language-babel package... [Enter steps to reproduce:]

  1. ...See above...
  2. ...

Atom: 1.16.0 x64 Electron: 1.3.13 OS: Mac OS X 10.12.4 Thrown From: semanticolor package 3.5.3

Stack Trace

Uncaught TypeError: Cannot read property 'enabled' of undefined

At /Users/sherilyn/.atom/packages/semanticolor/lib/semanticolor.js:194

TypeError: Cannot read property 'enabled' of undefined
    at setTimeout (/packages/semanticolor/lib/semanticolor.js:194:37)

Commands

Non-Core Packages

atom-beautify 0.29.23 
atom-bootstrap3 1.2.12 
atom-wrap-in-tag 0.6.0 
autocomplete-paths 1.0.5 
base-16-mexico-light-syntax-theme 0.0.1 
busy-signal 1.4.1 
color-picker 2.2.5 
docblockr 0.9.4 
emmet 2.4.3 
expand-region 0.2.7 
file-icons 2.1.4 
gemsource 0.3.0 
gl-light-syntax 2.2.0 
highlight-selected 0.13.1 
html2slim 0.4.1 
intentions 1.1.2 
language-babel 2.57.7 
language-slim 0.5.0 
linter 2.1.4 
linter-rubocop 2.1.1 
linter-stylelint 3.10.0 
linter-tidy 2.3.1 
linter-ui-default 1.2.3 
ocean-light-syntax 0.2.1 
pigments 0.39.1 
print-atom 0.1.1 
ruby-block 0.3.6 
semanticolor 3.5.3 
stylefmt 4.1.1 
terminal-plus 0.14.5 
theme-switcher 1.1.0 
toggle-quotes 1.0.1 
vibrant-ink-ruby 2.2.0 
sharedprophet commented 7 years ago

Yes, it is likely to occur only when you first install a new language grammar.