Comment with Line Comment does not work Follow
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?
Please sign in to leave a comment.
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"
BTW, what is your OS and keyboard layout?
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 https://youtrack.jetbrains.com/issue/JRE-215 for updates
Ah I see. Thanks!
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 (https://plugins.jetbrains.com/plugin/9525--env-files-support, 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 https://youtrack.jetbrains.com/issue/IDEA-165950 for details.
See also https://intellij-support.jetbrains.com/hc/en-us/articles/115000616724-MacOS-The-shortcuts-work-unexpectedly-after-2017-1-update
You have to reassign shortcuts in Preferences | Keymap to match your actual layout - see https://youtrack.jetbrains.com/issue/JRE-172#comment=27-1818287 and https://youtrack.jetbrains.com/issue/JRE-195#comment=27-1865191.
We are working on c reating special keymaps for different layouts, this is a part of https://youtrack.jetbrains.com/issue/IDEA-165950
There is a Fr keymap for OSX attached to https://youtrack.jetbrains.com/issue/IDEA-165950 - 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.
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!