emmetio / emmet-atom

Emmet support for Atom
MIT License
764 stars 181 forks source link

Multiple selection indenting with PHP Twig triggers Emmet #106

Open magicznyleszek opened 10 years ago

magicznyleszek commented 10 years ago

I have an if-else statement in twig with multiple cursors (marked by |):

{% if foo = 'bar' %}
    |bar-text
{% elseif foo = 'baz' %}
    |baz-text
{% else %}
    |default-text
{% endif %}

When I try to indent those three lines with tab, Atoms throws this error:

Uncaught Error: Passed an empty array to setSelectedBufferRanges /Applications/Atom.app/Contents/Resources/app/src/editor.js:1267
module.exports.Editor.setSelectedBufferRanges /Applications/Atom.app/Contents/Resources/app/src/editor.js:1267
module.exports._setSelectedBufferRanges editor-proxy.coffee:86
module.exports.exec editor-proxy.coffee:83
(anonymous function) emmet.coffee:44
module.exports.History.transact /Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/history.js:90
module.exports.TextBuffer.transact /Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:908
(anonymous function) /Applications/Atom.app/Contents/Resources/app/src/editor.js:1985
module.exports.Editor.batchUpdates /Applications/Atom.app/Contents/Resources/app/src/editor.js:2008
module.exports.Editor.transact /Applications/Atom.app/Contents/Resources/app/src/editor.js:1983
(anonymous function) emmet.coffee:43
(anonymous function) emmet.coffee:132
jQuery.event.dispatch /Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4676
elemData.handle /Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4361
module.exports.KeymapManager.dispatchCommandEvent /Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:395
module.exports.KeymapManager.handleKeyboardEvent /Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:176
(anonymous function) /Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:90
jQuery.event.dispatch /Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4676
elemData.handle /Applications/Atom.app/Contents/Resources/app/node_modules/space-pen/vendor/jquery.js:4360

The error doesn't brake any functionalities and the indentation works as expected. Only the console opening up is a bit annoying.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

nicolaiskogheim commented 10 years ago

Atom 0.123.0 Emmet 2.1.3

Same here. It only happens when using multiple cursors. Cannot reproduce in HTML-file, but in js I can.

emmet-atom-issue106 Larger image if you click on it.

EDIT: This happens even if Emmet successfully expands multiple abbreviations.

nicolaiskogheim commented 10 years ago

Looks like a duplication of #91

leompeters commented 10 years ago

The error continues here... @nicolaiskogheim @smutnyleszek . That duplicate issue still open...

leompeters commented 10 years ago

+1 https://github.com/emmetio/emmet-atom/issues/106#issue-36880078

leompeters commented 10 years ago

+1 https://github.com/emmetio/emmet-atom/issues/106#issuecomment-52997898

jelmerdemaat commented 9 years ago

:+1: I also have this issue (Atom v0.141 + Emmet v2.2.0 on Ubuntu 14.04). Happens on every multi-line indent in php/js/no extension files (and maybe more).