Where is the regular expression syntax highlighting information stored for inline strings in Resharper 9?

125 views Asked by At

There's this really cool new set of features in resharper 9. Particularly regarding Regex and the syntax highlighting. This post gives a good overview of how it works.

Basically, by putting your cursor on any string, and choosing this context command: Before known as regex

Will result in this highlighting: enter image description here

I want to know where resharper stores the reference to that string, and how it will then know it is a regular expression.

I can't find it in resharper settings anywhere (besides turning the feature on and off). Any idea where it could exist?

1

There are 1 answers

1
ulrichb On BEST ANSWER

It seems that this information is stored in the solution cache, because after deleting the cache, the manually triggered highlighting of regex strings disappear.

Anyways, by using typed regexes, R# automatically highlights them:

Regex field

If you really have to use strings, you could alternatively use the following trick utilizing the RegexPattern code annotation attribute.

RegexPattern attribute