idleberg / atom-atomizr

Converts snippets for Atom, Sublime Text, TextMate, and Visual Studio Code
MIT License
13 stars 1 forks source link

Uncaught TypeError: Cannot read property '_text' of undefined #6

Open tofagerl opened 7 years ago

tofagerl commented 7 years ago

[Enter steps to reproduce:]

  1. Tried to convert https://github.com/jeantimex/react-sublime-snippet/blob/master/React/Class%20Component.sublime-snippet to Atom
  2. Big ba da boom!

Atom: 1.18.0 x64 Electron: 1.3.15 OS: Mac OS X 10.12.6 Thrown From: atomizr package 0.23.1

Stack Trace

Uncaught TypeError: Cannot read property '_text' of undefined

At /Users/tom/.atom/packages/atomizr/lib/includes/sublime-text.coffee:69

TypeError: Cannot read property '_text' of undefined
    at Object.read_xml (/packages/atomizr/lib/includes/sublime-text.coffee:69:39)
    at Object.sublSnippetToAtom (/packages/atomizr/lib/atomizr.coffee:221:24)
    at Object.autoConvert (/packages/atomizr/lib/atomizr.coffee:101:8)
    at /packages/atomizr/lib/atomizr.coffee:66:96)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:265:35)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:65)
    at CommandRegistry.module.exports.CommandRegistry.dispatch (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:166:25)
    at AtomEnvironment.module.exports.AtomEnvironment.dispatchApplicationMenuCommand (/Applications/Atom.app/Contents/Resources/app/src/atom-environment.js:1314:34)
    at EventEmitter.outerCallback (/Applications/Atom.app/Contents/Resources/app/src/application-delegate.js:334:31)
    at emitThree (events.js:116:13)
    at EventEmitter.emit (events.js:194:7)

Commands

     -1:42.1.0 atomizr:convert-sublime-text-to-atom (input.hidden-input)
  2x -0:35.7.0 atomizr:convert-atom-to-sublime-text (input.hidden-input)
     -0:32.2.0 editor:move-to-first-character-of-line (input.hidden-input)
     -0:32.2.0 editor:consolidate-selections (input.hidden-input)
     -0:32.2.0 core:cancel (input.hidden-input)
  2x -0:30.1.0 atomizr:convert-sublime-text-to-atom (input.hidden-input)
     -0:07.9.0 atomizr:automatic-conversion (input.hidden-input)

Non-Core Packages

advanced-open-file 0.16.6 
atom-beautify 0.30.4 
atom-jade 0.3.0 
atom-material-ui 2.0.4 
atom-ternjs 0.18.3 
atomizr 0.23.1 
autoclose-html 0.23.0 
autocomplete-modules 1.6.10 
busy-signal 1.4.3 
colorful-json 1.1.0 
cson 2.0.1 
docblockr 0.11.0 
editorconfig 2.2.2 
emmet 2.4.3 
esformatter 2.3.0 
file-icons 2.1.9 
fold-functions 0.5.0 
gist 1.0.0 
highlight-line 0.12.0 
highlight-selected 0.13.1 
intentions 1.1.5 
isotope-ui 2.8.5 
jade-beautify 0.1.5 
jumpy 3.1.3 
language-babel 2.68.0 
language-docker 1.1.8 
language-kotlin 0.5.0 
language-pug 0.0.21 
language-tmux 0.4.0 
language-viml 1.1.4 
linter 2.2.0 
linter-coffeescript 1.0.0 
linter-eslint 8.2.1 
linter-jsonlint 1.3.0 
linter-kotlin 0.5.0 
linter-shellcheck 1.4.4 
linter-ui-default 1.6.3 
minimap 4.29.3 
minimap-highlight-selected 4.6.1 
nuclide 0.242.0 
open-recent 5.0.0 
pigments 0.39.1 
pretty-json 1.6.4 
react-snippets 0.9.0 
spacegray-atom-dark-syntax 1.3.2 
standard-formatter 2.8.0 
todo-show 1.11.0 
toggle-quotes 1.0.1 
idleberg commented 7 years ago

Thanks for reporting – this is indeed a bug. What actually should have happened is to display this warning:

This doesn't seem to be a valid Sublime Text snippet file. Aborting.

This is caused by the lack of a provided scope. Technically, the scope is optional by Sublime Text's definition, but it's required when creating an Atom snippet. In a future version, this could be the same way that's used when converting Visual Studio Code snippets.

However, the next version might take some time to complete, since it will be based on node-atomizr and there are still a couple of bugs to iron out – whenever I have time for this.