ReSharper 2024.3 Help

To-do lists

ReSharper provides an easy way to track tasks and technical debt in your code — code items (comments, string literals, or identifiers) matching a specific pattern can be easily located in the editor as well as in the whole solution using the To-do Explorer window.

ReSharper: To-do explorer

To-do items are highlighted in the editor and on the marker bar according to their types (Edit, Normal, Question, Warning, Error). Colors are configurable on the Environment | Fonts and Colors page of Visual Studio options:

Configuring editor and marker bar colors for ReSharper's To-do items

To-do patterns

By default, ReSharper provides three predefined patterns for commonly used To-do items of the following types:

  • A line in a comment containing TODO or TODO: some description (both case-insensitive) - Normal

  • A line in a comment containing BUG: (case sensitive) - Error

  • A NotImplementedException in the code - Edit

You can also define your own patterns, so that you could quickly access your specific technical debt items in the To-do Explorer window.

Define a custom To-do pattern

  1. Open the Tools | To-do Explorer page of ReSharper options Alt+R, O.

  2. Click Add on the toolbar.

  3. Provide a title for your To-do pattern and specify a regular expression with keywords that you want to detect in comments. For example, (\W|^)(?<TAG>Refactor)(\W|$)(.*).

  4. Select where ReSharper should apply the expression to find the To-do items (comments, strings, and/or identifiers).

  5. Optionally, specify whether the pattern is case-sensitive.

  6. Select a type for the pattern to define how matched items will be colored in the editor and in the To-do Explorer window.

  7. Click OK to add this pattern to the list.

  8. You can also duplicate, edit or remove existing patterns.

  9. Click Save in the Options dialog to apply the modifications and let ReSharper choose where to save them, or save the modifications to a specific settings layer by choosing this layer from the Save To selector. For more information, see manage and share resharper settings.

Multiline To-do items in comments

By default, To-do items in comments can be multi-line if the following lines are indented from the first line with at least one whitespace:

// TODO: beginning of the comment, // comment continued on the next line

If you want to have only single-line To-do items in comments, you can clear the Treat indented text on the following lines as part of the same To-do on the Tools | To-do Explorer page of ReSharper options Alt+R, O

When multiline To-do items in comments are enabled, you can choose whether to display multiline items as is or to display the whole multiline item in a single line. To do so, use the Enable multiline presentation button on the To-do Explorer toolbar:

ReSharper Enable multiline presentation or To-do items

Link To-do items to external URLs

In a To-do pattern, you can add a placeholder for items that will point to an external URL. This comes in particularly handy for issue trackers — you can use IDs of the issues in your comments, and ReSharper will let you open the corresponding issues in the browser or directly in the editor peek view.

Suppose your project is on GitHub and you want to add comments for GitHub issues in your code. All you have to do is create a custom To-do pattern for that:

  • Regular expression: (?<=\W|^)(?<TAG>GH \#(?<ISSUE_ID>\d+))(\W|$)(.*)

  • URL: https://github.com/<YOUR_PROJECT>/issues/${ISSUE_ID}

ReSharper. To-do pattern that recognizes GitHub issues

ReSharper will now treat GH #XX in your comments as links to the corresponding GitHub issues.

ReSharper. To-do link to GitHub issue from the comment

Besides Ctrl-clicking on these comments, you can also Ctrl+Shift-click to open the link in the editor peek preview. Both ways of navigating to the URLs are also available from the Alt+Enter menu.

To navigate between To-do items in the current file, use To-do marks on the marker bar.

Study To-do items in the whole solution

  1. Press Control+Alt+. or choose ReSharper | Windows | To-do Explorer from the main menu . Alternatively, you can press Control+Shift+A, start typing the command name in the popup, and then choose it there.

  2. In the To-do Explorer window that opens, click ThemedIcon.Down.Screen.(Gray).png or ThemedIcon.Up.Screen.(Gray).png to navigate to the next or previous item.

    To locate To-do items in the editor, double-click them .

    Viewing To-do items with ReSharper
  3. To study the source code of the selected item right in the window, click Show Preview ThemedIcon.PreviewToggle.Screen.(Gray).png on the toolbar. If necessary, you can locate the preview pane at the bottom or on the right.

Group and filter To-do items

By default, the To-Do Explorer lists to-do items based on the project structure. If necessary, you can change grouping options using the Group by selector. You can disable grouping, group by tags, types, namespaces, directories, projects.

ReSharper: Grouping To-do items

Depending on the size and age of the codebase, there may be lots of To-do items. To focus on specific items, you can filter To-do items by pattern (for example, TODO or BUG) — just select the desired patterns in the Filter ThemedIcon.Filter.Screen.(Gray).png selector to display items matching the corresponding patterns and hide all others.

To-do Explorer window toolbar controls

Control

Name

Description

ThemedIcon.ExpandAll.Screen.(Gray).png ThemedIcon.CollapseAll.Screen.(Gray).png

Expand All/Collapse All

Expands/collapses all nodes in the current tab.

ThemedIcon.Up.Screen.(Gray).png ThemedIcon.Down.Screen.(Gray).png

Previous/Next


Shift+F8/F8

Navigate to the previous/next item and scrolls through the source code accordingly.

ThemedIcon.PreviewToggle.Screen.(Gray).png

Show Preview Ctrl+P

Hides or shows the pane with a preview of the selected item in the position specified using the list (at the bottom or in the right part of the window).

ThemedIcon.Export.Screen.(Gray).png

Export

Click this button to export the data currently displayed in the window in text format , or use the drop-down selector to export the data in an XML or HTML format. The Export Data dialog that appears will help you save the data to a file or copy it to the clipboard .

ThemedIcon.Settings.Screen.(Gray).png

To-do Settings

Opens the Tools | To-do Items page of ReSharper options , where you can manage patterns for To-do items.

ThemedIcon.Highlighting.Screen.(Gray).png

Paint items

Toggles coloring of To-do items in the window according to their types (Edit, Normal, Question, Warning, Error). Colors are configurable on the Environment | Fonts and Colors page of Visual Studio options:

Configuring editor and marker bar colors for ReSharper's To-do items

Enable multiline presentation

Enable multiline presentation

When multiline To-do items in comments are enabled, you use this button to choose whether to display multiline items as is or to display the whole multiline item in a single line.

ThemedIcon.GeneratedCode.Screen.(Gray).png

Show To-do items in generated code

Allows you to show or hide To-do items in generated code. You can configure the list of files and regions containing generated code on the Code Inspection | Generated Code page of ReSharper options .

Filter

Use this list to select a filter to show items that pertain to the corresponding pattern only. By default, five filters are provided:

  • (all)

  • Todos

  • Notes

  • Bugs

  • Not Implemented

Group by

Use this list to select criteria for grouping To-do items. Several options are provided:

  • None - items are displayed as a plain list.

  • Types - items are grouped by containing types.

  • Namespaces - items are grouped by namespaces, which are displayed as a plain list, with nesting structure not taken into account.

  • Namespaces and Types - items are grouped by namespaces and, on a lower level, by classes where they are encountered.

  • Directories - items are grouped by directories where they are stored; directories are displayed as a plain list, with nesting structure not taken into account.

  • Files - items are grouped by their containing files.

  • Directories and Files - items are grouped by directories where they are stored and, on a lower level, by their containing files; directories are displayed as a plain list, with nesting structure not taken into account.

  • Projects - items are grouped by their containing projects.

  • Projects and Types - items are grouped by containing projects and, on a lower level, by types.

  • Projects and Directories - items are grouped by containing projects and, on a lower level, by directories; within a project, directories are displayed as a plain list, with nesting structure not taken into account.

  • Project Structure - items are grouped according to the physical structure of a project, with all nesting relationships represented.

This feature is supported in the following languages and technologies:

Language: C#

Language: VB.NET

Language: C++

Language: HTML

Language: ASP.NET

Language: Razor

Language: JavaScript

Language: TypeScript

Language: CSS

Language: XML

Language: XAML

Language: Resx

Language: Build Scripts

Language: Protobuf

Language: JSON

Feature is available in C#

Feature is available in Visual Basic

Feature is available in C++

Feature is available in HTML

Feature is available in ASP.NET

Feature is available in Razor

Feature is available in JavaScript

Feature is available in TypeScript

Feature is available in CSS

Feature is available in XML

Feature is available in XAML

Feature is available in Resource files

Feature is available in build script files

Feature is available in Protobuf

Feature is not available in JSON

The instructions and examples given here address the use of the feature in C#. For more information about other languages, refer to corresponding topics in the ReSharper by language section.

Last modified: 13 November 2024