Using TODO Comments
When working on a project, you sometimes need to mark some 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 some attention.
By default, there are two patterns recognized by AppCode: the words
FIXME in both lower and upper case. These patterns can be used inside comments of any supported file type. You can modify the default patterns or add your own patterns if necessary.
Open the TODO tool window
- On the View menu, point to Tool Windows, and click TODO (⌘6).
The TODO tool window consists of the following tabs:
- Project: Shows TODO items for the whole project.
- Current File: Shows TODO items for the currently open file in the editor.
- Scope Based: Shows TODO items for a certain scope, selected from the drop-down list.
- Current Changelist: Shows TODO items in the active changelist (available only if version control integration is enabled).
To jump to the location of the relevant comment in the source code, double-click the corresponding TODO item in the TODO tool window. To automatically jump to the location of the relevant comment every time you select the corresponding TODO item, right-click the TODO tool window title bar, point to View Options, and select Autoscroll to Source (this option is enabled by default).
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 might choose to mark places of possible optimization in your code with the
OPTIMIZE pattern and ignore all other types of TODO items:
- In the TODO tool window, click the Filter TODO Items icon () and then click Edit Filters to open the TODO dialog.
- To add a pattern for the
OPTIMIZEitems, click the Add icon () in the Patterns section of the TODO dialog, and type the following pattern:
\boptimize\b.*Then click OK to save the new pattern.
- To add a filter with the new pattern, click the Add icon () in the Filters section of the TODO dialog, specify a name for the new filter, and select the new pattern to be included in this filter. Then click OK to save the new filter.
- Click OK to apply changes in the TODO dialog.
- To apply the new filter, in the TODO tool window, click the Filter TODO Items icon () and select the necessary filter.