Comment and uncomment blocks of code
You can comment or uncomment the current line or selected block of source code.
Commenting feature extends to all supported file types. For the custom file types, you can define line and block comments characters, as described in the section File type associations.
Comment and uncomment lines of code
To add or remove a line comment, do one of the following:
Go to
.Press Ctrl+/.
If multiple nodes should be commented or uncommented with a single action, select all the nodes that should be affected and then invoke the Comment with Line Comment action as described above.
Troubleshoot
The Ctrl+/ shortcut currently does not work on keyboard layouts that do not have a dedicated /
key, such as some national ones.
As a workaround, you can assign another key combination for these actions:
Press Ctrl+Alt+S to open the IDE settings and then select
.In the search field, type
Comment with block comment
orComment with line comment
to locate the required action on the list.Right-click the action, select Add Keyboard Shortcut, and press the necessary key combination.
Apply the changes and close the dialog.
For more information about assigning new key combinations to actions, refer to Add a keyboard shortcut.