AppCode 2023.1 Help

TODO comments

Sometimes, you need to mark parts of your code for future reference: areas of optimization and improvement, possible changes, questions to be discussed, and so on. AppCode lets you add special types of comments that are highlighted in the editor, indexed, and listed in the TODO tool window. This way you and your teammates can keep track of issues that require attention.

Example of TODO comment

By default, there are two patterns recognized by AppCode: TODO and FIXME in both lower and upper case. These patterns can be used inside line and block comments of any supported file type. You can modify the default patterns or add your own patterns if necessary.

Add a TODO comment

  • Place the caret where you want to create a TODO comment, for example, by pressing Ctrl+/, then type TODO or FIXME, and then type your note.

You can also create a live template for adding the TODO comments with some predefined content. See an example on page Create live templates.

Add a multiline TODO comment

  • To create a multiline TODO item, indent the comment lines that follow the initial line (with at least one tab or two spaces). Without the indent, lines are treated as regular comment lines.

To disable multiline TODO items, in the Preferences dialog (Ctrl+Alt+S), go to Editor | TODO and clear the Treat the indented text on the following lines as part of the same TODO checkbox.

View a list of all TODO comments

  1. To view TODO items, open the TODO tool window: View | Tool Windows | TODO. Use tabs to change the source of TODO items you want to view: from all files in your current project, only those in the current file, based on a certain scope of files, or from files in the active changelist (if you have version control integration configured).

    The TODO tool window
  2. To jump to a TODO comment in the source code, click the corresponding TODO item in the TODO tool window. To disable this behavior, use the Navigate with Single Click button The Navigate with Single Click button on the toolbar (in this case, you will need to double-click the TODO item to jump to the relevant comment).

Add custom patterns and filter TODO items

You can add your own patterns and filter the list to show only TODO items that match certain patterns. For example, you can choose to mark places of possible optimization in your code with the OPTIMIZE pattern and ignore all other types of TODO items when viewing them in the TODO tool window.

  1. In the Preferences dialog (Ctrl+Alt+S), select Editor | TODO.

  2. Use a regular expression to specify a custom pattern.

    For example, to add a pattern for the word OPTIMIZE in a comment, click The Add button in the Patterns section of the TODO dialog, and type the following regular expression:


    This matches the word "optimize" (\b designates word boundaries) and allows any number of other characters in the comment.

    Then click OK to save the new pattern.

  3. Add a filter to group TODO patterns and view the corresponding TODO items in the TODO tool window separately.

    For example, to add the Optimization filter with the new pattern, click The Add button in the Filters section of the TODO dialog, specify Optimization as its name and select the new pattern to be included in this filter.

    Then click OK to save the new filter.

  4. Click OK to apply the changes in the TODO settings dialog.

  5. To apply the new filter, in the TODO tool window, click the Filter TODO Items button and select the Optimization filter.

The icon that you select for a pattern is displayed in the TODO tool window to better distinguish various TODO items. By enabling the Case Sensitive checkbox for a pattern, you can force the pattern to match only with the specified case.

Last modified: 31 March 2023