UltCombo / atom-sublime-block-comment

An Atom Editor plugin to toggle block comments, inspired by Sublime Text.
MIT License
10 stars 2 forks source link

Added support for HTML block comments #1

Closed vojtechjelinek closed 9 years ago

vojtechjelinek commented 9 years ago

Support for , /* */ are still default but for all html files the are used.

UltCombo commented 9 years ago

Thanks for working on this.

If I recall correctly, I've tried to do this using cursor.getScopeDescriptor(), because you can have other languages such as CSS and JS embedded in the HTML and it would be nice to add the correct comment syntax for the scope where the cursor is at.

The problem gets more complex when you consider a selection that crosses language boundaries (i.e. the beginning of the selection and end of the selection belong to different scopes), in this case I'd priorize the language at the beginning of the selection because the user would most likely be commenting out the token which causes the scope change.

In the end, I couldn't get it working as good as Emmet's toggle-comment (which works great for HTML and CSS), so I didn't include it in this package.

I'll merge this if you can add support for HTML without breaking the comment syntax on embedded languages (specifically, code inside <script> and <style> tags).

vojtechjelinek commented 9 years ago

So, what do you think?

UltCombo commented 9 years ago

Oh sorry, I didn't see that you've added new commits. I will review it soon. :)

UltCombo commented 9 years ago

Looks good, I'll make a few tweaks and merge. :smiley:

UltCombo commented 9 years ago

Merged, thanks! I've implemented the approach I've described above in this commit. It seems to work fine in my initial tests, but it would be nice if you could test/review it as well.

UltCombo commented 9 years ago

Released as v0.2.0.