Toggle Line Comment not working



I’m a new coder and user of atom. I installed atom a few days ago, and it was working just fine. Today, I noticed the Toggle Line Comment (CMD-/) does not work any more.

I opened the Keybindings console in Settings, and typing CMD-/ shows this:

‘atom-workspace atom-text-editor:not([mini])’:
‘cmd-/’: ‘editor:toggle-line-comments’

Hitting CMD-. and then CMD-/ shows similar command in a greyed box with “X” cross sign next to it. Key Binding Resolver shows CMD-/

I tried running atom --safe, and the problem is replicated.

It’s rather unusual as my sublime text editor has CMD-/ disabled for the toggle comment line as well. But, every other web-based editor like and Code Academy, CMD-/ works just fine.

I am using macOS Sierra 10.2.3, Atom version 1.14.1 on a MacBook Air 2011. It’s a USA-keyboard and only USA-keyboard is installed on my OS.

I’d appreciate any help how to resolve this for a newbie. :slight_smile:

Many thanks in advance!



Can you include a screenshot of the Keybinding Resolver panel when you try to use the keybinding that isn’t working for you?


Here is a screenshot of the keybinder which doesn’t work for me:


You should take a screenshot of the Keybinding Resolver as it appears when you try to use that command in a file.


I’m sorry, I don’t quite understand, you mean take a screenshot whilst holding down that command while in Atom? If so, the result is exactly the same as the screenshot above.


You’re in Atom in the screenshot above, but you’re in the Settings view, not actually in a file. You have to have a file active and have the cursor on a line in order for the command to be meaningful (as indicated by the selector atom-text-editor:not([mini])). Please try that, take a screenshot, and post it.


Aaaah… okay. Got it.

Guess what. It appears green now, but it’s not being commented out.

Another thing, I downloaded Textastic and Textwrangler. Textastic has the same problem as Atom and others, but for Textwrangler the toggle comment line function works!


The problem is that the file is set as plain text (those files don’t have extensions, for whatever reason, so Atom has no idea what they’re supposed to be). Atom converts the selected lines into comments based on the comment syntax of the chosen language, but with the file as plain text it has no idea what the comments should look like.


Oh, so Atom only recognises a certain kind of text file? I looked at Finder and the files are saved as TextEdit Document. What file format should they be?

The weird thing is, those files are exactly the same format when I created them last week, and the toggle line comment was working.


Atom detects what filetype you’re editing based on the file extension (it’s actually a bit more complicated than this, but just to keep it simple…). Since none of your files have an extension, Atom defaults to plain text. They look Python-like to me, so try clicking on the “Plain Text” indicator and changing it to Python.


Oh, I see… it was Ruby code which I was working on. So, basically I had to save the files as .rb, lol! Silly me :stuck_out_tongue_winking_eye:

I’m new to coding, so I thought when I entered the file name and hit save, it automatically appends a .rb to the file. I hadn’t realise Atom is a text editor for many languages, hence it saves as a text file if I don’t specify. I assumed it was like Microsoft Word etc where the extensions are added automatically when saving.

Thanks guys for the help!