Skip to content

Comment and put reminders

Insert descriptive comments

Putting comments inside the source code of a computer program really helps describing its features, especially if the project is shared by a team, and Studio projects are no exception.

Note

Comments are ignored by the compiler, they are not "code".

It is recommended to write meaningful comments that will help both other programmers and, in time, the author, to understand the code.

You can insert line comments or block comments using the expert.ai languages syntax.
Line comments can also be placed at the end of a line of code.

Comment to "disable" code

Comments may also be used to 'disable' parts of code that you may want to keep. For example, if you would like to report a bug fix, the juxtaposition of the previous code along with the current version is an easy way to note how the code has evolved.

You can comment out a piece of code by hand or use the dedicated commands.

To comment out lines of code with line comments:

  1. Select the rows.
  2. Select Code > Comment with Line Comment on the main menu.

    Or:

    Press Ctrl+NumPad /

To comment out lines of code with a block comment:

  1. Select the rows.
  2. Select Code > Comment with Block Comment on the main menu.

    Or:

    Press Ctrl+Shift+NumPad /

The commands above act as a comment-uncomment toggle, so to uncomment lines of code previously commented with a given command, use the same command.

Put reminders

Reminders—or TODO items—are special comments that programmers insert into the source code to mark points where there is still something to be done: additions, changes or fixes.

By default, Studio automatically recognizes two types of reminders:

  • TODO
  • FIXME

and automatically transforms them in useful bookmarks that are listed in the TODO tool window.

Recognition is based on patterns: all comments starting with TODO or FIXME are considered TODO items.
So, to put a reminder just insert a comment and start it with TODO where there's something left to do or FIXME where a correction is needed.

Custom patterns can be defined at will, check the IntelliJ IDEA documentation for more information.