How to get multiline TODO's in Resharper 8
Asked Answered
S

1

21

I have be trying to figure out how to change the regular expression in the Options -> To-Do's in resharper to color code and allow for multiple lines in a todo.

Any Ideas?

Spidery answered 28/5, 2014 at 20:42 Comment(0)
S
40

I figured out the answer, easier than I thought

Orignal regex for todo's in resharper (?<=\W|^)(?TODO)(\W|$)(.*)

It is possible to do this using just regex...

Go into Resharper -> Options -> To-Do Items and change the existing regex to

(?s)(?<=\W|^)(?<TAG>TODO)(\W|$)(.*)

The (?s) option allows for mutliline TODO's

The format of the todo is

        /* TODO: a Multiline
         * to do list must use the block comment style
         * though it will appear spaced out in the To-do explorer
         * it will color code it all correctly
         */
Spidery answered 28/5, 2014 at 20:51 Comment(3)
Ah. (?s) turns on the "single line" option, so the period in the (.*) part of the expression also matches newlines. The whole thing terminates because ReSharper only matches against nodes in the syntax tree, and this is a multi-line comment node, so the end of the text to match against is the */. Very nice.Pressure
Thanks, was working on a way to exclude the whitespace between the \r\n and * from the capture so that the todo comment would not have gaps in the text when viewing in the to-do explorerSpidery
It works in the text editor but to To Do Explorer in R#8 doesn't pick up all the lines. +1 anyway because it's handy.Dentist

© 2022 - 2024 — McMap. All rights reserved.