Comment selected text, not entire line


#1

CMD-/ nicely comments an entire line. It also comments multiple lines if I select them. But if I selected specific text within a single line, the entire line still becomes the comment. Only my selection should become the comment.

Perhaps some languages do not permit this, but I’m primarily concerned with HTML, CSS, and JS

This behavior is present in Sublime Text if you need an example.

I apologize if this has already been requested. I did a search and did not see it.


#2

I have the same problem here.
If you use php in atom it is really a problem than the comment is not working because the commentsyntax is outside the php brackets.


#3

Last I checked, there isn’t support in the API for commenting out just the selection in languages that support it. Check out language-mode.coffee in atom/atom for what is there.


#4

I’m new here, how do I upvote this?


#5

Just made the switch to Atom from Sublime Text and whilst I love the editor this is one thing I sorely miss. Has anyone made any progress on this issue?


#6

Actually I got around this by changing my keymap to have block-comment handle ‘cmd-/’ as follows:

'atom-workspace atom-text-editor:not([mini])':
  'cmd-/': 'block-comment:toggle'

Hope this helps someone.


#7

Could you walk me through the steps on how you altered your Atom?

I thought I found the right place and put in what you wrote but so far I see zero change. I was hoping your fix would make Atom’s comment function work like Sublime’s comment function.


#8

post deleted , found solution


#9

Your solution is great for HTML.
Same thing wityhn PHP tags (/SELECTION/) ?

Thanks