WebStorm 2018.2 Help

Using TODO Comments

When working on an application, you may want to mark some parts of your code for future reference: areas to optimize and improve, possible changes, questions to be discussed, etc. In WebStorm, you can add special types of comments that are highlighted in the editor and listed in the TODO Tool Window.

Using default patterns

By default, WebStorm recognizes two patterns — the words TODO and FIXME both in the lower and in the upper case. These patterns can be used inside comments of any supported file type.

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

  2. View the list of TODO items in the TODO tool window (Alt+6). The tool window consists of four tabs where WebStorm shows TODO items for the whole project, for the file in the active editor tab, for the selected scope, or for the active changelist.

    • By default, when you select an item you automatically jump to the corresponding comment in the source code. To disable this automatic navigation, right-click the tool window title bar, click View Options, and then remove the tick next to Autoscroll to Source.

    • With Autoscroll to Source disabled, double-click the required TODO item to jump to the corresponding comment in the source code.

Using custom patterns

You can modify the default patterns or add your own patterns and filter the list to show only TODO items that match certain patterns. For example, you may want to mark code fragments that require optimization with the OPTIMIZE pattern and ignore all other types of TODO items.

  1. In the Settings/Preferences dialog (Ctrl+Alt+S) click TODO under Editor.The TODO page opens.

  2. To add a pattern for the OPTIMIZE items, click Add icon in the Patterns area and type the following pattern: \boptimize\b.*

  3. To add a filter with the new pattern, click Add icon in the Filters area, specify a name for the new filter, and select the new pattern to be included in this filter.

To apply a custom filter

  • In the TODO tool window, click Filter TODO Items and select the necessary filter.

Last modified: 24 September 2018