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!

About Maarten Balliauw

Maarten Balliauw is a Developer Advocate at JetBrains, working on .NET tools and Space. He focuses on .NET, Azure, web technologies and application performance. Maarten is a frequent speaker at various national and international events. In his free time, he brews his own beer. Follow him on Twitter or check out his personal blog.
This entry was posted in How-To's and tagged , , , , . Bookmark the permalink.

3 Responses to Linking to external resources in ReSharper to-do items

  1. Mike-EEE says:

    Wow this is really neat! How cool is this? This would be handy to tie into StackOverflow issues as well, as I have been doing that whenever I find a cool code snippet or when pointing to a design decision. Nice work here, team.

  2. Anthony Brien says:

    Doesn’t seem to be available in Rider. I don’t see this URL text box in Rider EPA 2018.1.

Leave a Reply

Your email address will not be published. Required fields are marked *