Commenting code selection sometimes comments the whole line bug


Say I have a line of code like the following:


I want to add a comment after it to know what it is closing so I type:


So far so good. Then I select “/#header” and click cmd /

In sublime, or any other text edit that I have used it would turn that selection into a comment. To note I am in HTML mode. But in Atom instead it turns in the entire line into a comment like the following:

<!-- </div> /#header -->

Where is it should be:

</div> <!--  /#header -->

To note, it works without the “/” in the code, so I think it’s that character that is causing the bug in Atom. Overall Atom is amazing! Didn’t think life could get better than TextMate until I met Sublime and better than Sublime until I met Atom. While some of these small glitches make hard to switch 100% to Atom, for a 1.0 version it’s incredible. Thank’s github and the community for building it.


It isn’t a bug, as far as I know, but intended.
Cmd-/ or Ctrl-/ are for the entire line.

The command executed this way is “Toggle Line Comments”:


Hmm. In all the editors I’ve used such as Sublime (which is where mots all Atom users will be coming from) and TextMate and Coda, if no text is highlight/selected then yes cmd / will comment the whole line. But in all those editors if you have selected part of text from a line and do cmd / then it will of course only comment that selection, since a person wouldn’t highlight a particular selection and then cmd / with the expectation that the whole line would comment rather than just their selection.

Since adding this functionality would make it work like other editors and would still work as it currently does for people who want to select the whole line, but simply putting their cursor on a line and doing cmd /


I’d agree with this. That behavior would be intuitively expected.
It’s worth a PR in my eyes, if there’s not already one.


I do that all the time if I want to disable a piece of code. I love that I don’t have to care what exactly I have to select…