Sublime Forum

How does comment toggling work?

#1

I don’t understand how the Comments.tmPreferences file works. I’m working on the SCSS package and have the following:

gist.github.com/1121399

This works fine: hitting ctrl-/ comments a line by adding //[space] to the beginning. If I select a region and do the same, each line is commented. Hitting Ctrl-Shift-/ does exactly the same. So far, so good.

What I’d like to do is, when hitting Ctrl-Shift-/, the alternate type of comment would be used; i.e., /* some stuff */. This is a block style comment, so it only needs to add the comment tokens at the start and end, just like CSS. So I looked at the CSS comments.tmPreferences and use that to create this one for SCSS:

gist.github.com/1121410

Now when I select a region and hit Ctrl-Shift-/, the correct tokens get inserted at the start and end. However, a subsequent hit of Ctrl-Shift-/ doesn’t toggle the region comment off again but instead adds another set of tokens.

How can I get it to toggle off like the CSS syntax does?

0 Likes