Dotnet logo

.NET Tools

Essential productivity kit for .NET and game developers


Linking to external resources in ReSharper to-do items

ReSharper comes with a To-do Explorer that makes working with TODO comments in code easier. We’ve seen we can navigate and manage to-do items, export them to a file, and define our own to-do patterns. In this post, let’s look at what ReSharper 2017.3 brings to the table.

This post is part of a series around working with to-do items in ReSharper. Keep in mind: we can also use Rider to work with to-do items!

Linking to external resources in to-do items

This one is new in ReSharper 2017.3 – we can create a to-do item pattern that links to a URL. For example, we can create a new to-do pattern that checks for comments starting with a YouTrack issue number, typically in the format XX-111. If we capture the issue number in a group, we can use it in the URL field below:
Capture YouTrack issue in to-do item

In the To-do Explorer, we can now see to-do items that match this regular expression. These to-do items will also be shown in source code, where the content that is matched in the “TAG” capture group contains a clickable link to our issue tracker. We can Ctrl+click it, or use Alt+Enter to navigate to the external link (or open the item in the To-do Explorer tool window).
Open external resource from to-do comment

In case you want to add a pattern to YouTrack, or GitHub, here are a few regular expression and URL patterns that can be used:

  • YouTrack (make sure to edit the URL to match your YouTrack instance):
    Matches comments similar to: // RSRP-123 Issue
    Regular expression: (?<=\W|^)(?<TAG>[A-Z]+\-\d+)(\W|$)(.*)
  • GitHub (make sure to edit the URL to match your GitHub project):
    Matches comments similar to: // GH #123 Issue
    Regular expression: (?<=\W|^)(?<TAG>GH \#(?<ISSUE_ID>\d+))(\W|$)(.*)

If we now encounter a to-do item in code which links to an external issue, we can use Peek To-do link (Ctrl+Shift+click) to display the issue inline:
Use Peek Definition to display GitHub issue content inline

Download ReSharper 2017.3 and give it a try! We’d love to hear your feedback!

image description

Discover more