IntelliJ IDEA 14.0.0 Web Help

Commenting and Uncommenting Blocks of Code

In this section:


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 Creating and Registering File Types.

Configuring commenting behavior

It is possible to force IntelliJ IDEA to place Java comments strictly at the left margin. To do that, in the Settings dialog, open Code Style | Java, and click Code Generation tab.

In the section Comment Code select the required check boxes:


If the check boxes are cleared, the comments characters are placed at the current caret position.

Commenting and uncommenting lines of code

  • On the main menu, choose Code | Comment with Line Comment .
  • Press Ctrl+Slash.

Commenting and uncommenting blocks of code

  1. On the main menu, choose Code | Comment with Block Comment .
  2. Press Ctrl+Shift+Slash.

See Also

Last modified: 4 December 2014
comments powered by Disqus