Comment with Line Comment does not work

Hi

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?

 

m

25 comments
Comment actions Permalink

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.

https://www.jetbrains.com/help/webstorm/2016.3/keymap.html

0
Comment actions Permalink

BTW, what is your OS and keyboard layout?

0
Comment actions Permalink

Hi there

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

 

0
Comment actions Permalink

What keyboard layout do you use?

0
Comment actions Permalink

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

3
Comment actions Permalink

Ah I see. Thanks!

0
Comment actions Permalink

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?

Thanks
Eti

 

0
Comment actions Permalink

>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.

1
Comment actions Permalink

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)?

1
Comment actions Permalink

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.

0
Comment actions Permalink

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.

0
Comment actions Permalink

@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

0
Comment actions Permalink

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?

0
Comment actions Permalink

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

0
Comment actions Permalink

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.

2
Comment actions Permalink

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?

0
Comment actions Permalink

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.

0
Comment actions Permalink

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:

https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000118344/comments/360000105350

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

1
Comment actions Permalink

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

1
Comment actions Permalink

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+/

0
Comment actions Permalink

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

0
Comment actions Permalink

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.

 

3
Comment actions Permalink

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.

0
Comment actions Permalink

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!

0

Please sign in to leave a comment.