Comment with Line Comment does not work


I have small but infuriating problem. I have default settings according to which ctrl + / should comment a line and ctrl + shift + / should comment a block. Instead what it does is folding a block of code. 

any reason why this happens?




Hi there,

Please check your keymap -- what shortcuts are assigned to actual action etc and adjust them as needed (in case if shortcut does not work on your locale/keyboard)

"Settings/Preferences | Keymap"

  • You may choose another keymap (that better suits your OS) or create your own (based on currently selected)
  • You have a search field there where you can type the action name (e.g. "comment" -- without quotes obviously)
  • There isa button next to the search field that allows to search other way around -- to find an action by currently assigned shortcut.


BTW, what is your OS and keyboard layout?


Hi there

I use Linux and default settings. In theory it says ctrl + / should work but it does not 



What keyboard layout do you use?


That's the issue. The problem is that java returns incorrect key codes unless EN keyboard layout is default and the first in the list.

We have fixed the problem in our custom JRE for Mac OSX, but fix for Linux is still in progress. Please follow  for updates


Have the same problem. I believe a different cause. The comment abilities have been greyed out in the menu - see pic.

It seems to be related to the file type of .env Probably webstorm does not know what char to use for the comment in this kind of file?

What would the solution be?




>It seems to be related to the file type of .env Probably webstorm does not know what char to use for the comment in this kind of file?

>What would the solution be?

Contact plugin author and ask to implement it.

Each language/file type has own rules (symbols) for comments .. and plugin must provide them so IDE knows how to perform such action.

At the same time: ".env files support" plugin (v0.6) supports commenting in .env files  -- tested in PhpStorm 2017.3.6 on Windows 10.


This action is only available for known file types - IDE needs to know what code to create when action is called.

what file type is `.env` extension associated with in Settings | Editor | File Types? Do you use special plugins for it (, for example)?


The problem appeared now in IDEA 2018.2, also polish keyboard layout. Previous build 2018.1 was used with excatly same environment and settings (JRE/keyboard) and worked as expected, so for me looks like clear regression.


I have the same issue on a MacBook Pro with IDEA 2018.2 and a french keyboard layout.

Pressing ^⇧/ does nothing

Pressing ⇧⌘/ makes the "Code" menu blink and nothing more. The weird thing is that one this code menu is open, pressing the same keys actually put the selected text in the editor in comments.

I would like to avoid changing the key mapping as all developers in my team are working on different OS and everyone should have the same shortcuts in mind.


@Alban Fayard It's a complex issue, please see for details.
See also
You have to reassign shortcuts in Preferences | Keymap to match your actual layout - see and

We are working on c reating special keymaps for different layouts, this is a part of

There is a Fr keymap for OSX attached to - Mac_OS_X_10.5_Plus_fr.jar; you can give it a try


Thanks for the quick reply Elena. However, I did not find the instructions on how to use the FR keymap. Could you provide some help in this regard?


You need to download the .jar and import it in IDEA using File | Import settings


I had the same issue after installing the german keyboad support. 

The solution was to "push" the English language, so that it is on top in Settings > Region and Language > input Source.


It works fine on a German keyboard, if you have a numeric keypad and set the Num key permanently, instead of using the keypad for cursor movements.

However, since I installed  PyCharm 2019.2 (Community Edition), Build #PC-192.5728.105, built on July 23, 2019, it does not work for .cfg files. For Python code it still works fine.

Any ideas?


I have a solution that worked for me.

I'm on Windows 10, and I had a TextExpander running in the background on an expired trial account (don't know if that part matters though), as soon as I quit that, ctrl+/ in PyCharm started working for me (and probably would in any other JetBrains IDE like IntelliJ, CLion, WebStorm, etc, listed out so people Googling will find this easier).

I'm sure ctrl+/ probably was globally bond to a function in TextExpander, but couldn't see what because my expired account prevented me from getting into the preferences.


In Ubuntu 19.10 with intellij 2019.3 the shortcut won't work unless the first keyboard layout is EN-US, as stated by Elena:

That is, it seems that despite the layout selected intellij will read all shortcuts in the first (default) language.


Same issue here - am I getting something wrong or has this issue been reported like almost three years ago and nothing has ever been undertaken ever since to tackle this problem? :-p


Hey, I noticed the same effect in my fresh WebStorm install.

In my case the problem actually was that WebStorm wasn't recognizing the file type as PHP. To fix this, go to your *.php file, open actions, input "Associate with file type", in the modal search for "PHP (Syntax Highlighting Only)", then click OK.

I am now able to comment with CTRL+/


The sa me issue. two bugs in two days. Why you are top 1 ide for python?


As said in keymap default settings, it can be either CTRL+ / or CTRL+ "numpad /"

In my case, on Debian Stretch with a laptop keyboard, while the former never worked, the latter does : combining CTRL + FN + / (not the basic slash in the right lower corner, but the slash associated with FN ...)

Hope it helps some of you.



I have the same problem. I have set up the new shortcut for MAC command+1 but it doesn't work at all. However, the short cut for running the code in Python Console works just fine. 

Can someone please help me out.


I tested Kojo's recommendation (using Ctrl + numeric pad /) and it also works on Datagrip 2022.2.1 / Windows 10 / Belgian (period) keyboard.

It works for a line and a text block. Uncomment with Ctrl + numeric pad /. 

Ctlr + Shift + numeric pad / will put a line or block or text in /* ... */. Undo with the same shortcut (Ctlr + Shift + numeric pad /).

Worth a try!


I noticed same problem with IntelliJ IDEA 2023.1.4(Ultimate Edition)

Pressing CTRL+/ started to fold block of code instead of add line comment...

If I check keymap, everything seems to be OK for "Comment with Line Comment", there is value of "Ctrl+/ Ctrl+NumPad /"

  • when I remove "Ctrl+/" mapping and try to add it again in "Keyboard Shortcut" dialog, pressing "Ctrl+/" actually causes "Ctrl+Minus" to be shown, when I press only "/" it actually causes "Minus" to be shown...
  • when I close the dialog(pressing Cancel) and press "/" in editor window "/" shows correctly, when I press "Ctrl+/" in editor window it folds code block so it looks like "Ctrl+Minus" is detected

any ideas?


I had the same issue, after changing my keyboard layout from german to english. After making sure that I set the same layout using the systemsettings for my window manager (I'm unfamiliar with ubuntu, in kde it is called systemsettings) and localectl (in the terminal) the issue was resolved.


My issue has nothing to do with the keyboard. Even when I choose Code > Comment with Line Comment from the menu, nothing happens. I am using CLion under Windows.


Charneykaye Can you please share a bit more context around the problem? Which version of the IDE are you using? What file do you edit? is the issue specific to certain file/file type?


I'm on Debian using CLion 2024.1. When selecting a line and choosing "Code→Comment With Line Comment". It does not work at all.

The file is a .c file.

I can navigate to the function definitions in the file (pressing Ctrl and clicking on the function name takes me to the declaration of the function. So I'm sure CLion understands the structure of my file)

I'm pretty sure the issue is in the functionality of the commenting module itself not the invocation (aka pressing Ctrl+/) for my case.


Please sign in to leave a comment.