Eclipse (at least when using Java) has the feature to auto highlight all lines in a method where method returns when I place cursor on return type in method definition.
Is there also such a feature for C# in Visual Studio + ReSharper 5.1.3?
Code example
string Do()
{
if(/**/)
return ""; // here
if(/**/)
return "1"; // here
if(/**/)
return "2"; // here
throw new Exception(""); // here
}
When I place cursor on word string in first line of this example the lines marked with // here
should be highlighted.
It looks like the VS2010 extension called Linguist will do close to what you'd like. It can do customized highlighting for any regular expression. It doesn't appear to be able to change it based on your cursor location though.
More information for the extension can be viewed at the github page.
There is no GUI for the settings. Instead there are settings files
%LOCALAPPDATA%\Linguist
in that you configure.Since I already have my syntax highlighting the way I'd like it to be with Resharper, I removed all the formatting from the
Styles.field
file in thestandard
subdirectory. If you do this you need to leave in all the names though, so it will look similar to:Styles.field
You will need to set up one of the named styles to use for highlighting. I did:
And then I made a file called
custom.lang
(but you can name yours anything with the .lang extension) in thecustom
subdirectory. and this is what I did for highlighting return statements:custom.lang
That got things working for me. A bit complex, but it's free. Another way to do it might be to clear out the
standard\C#.lang
file so you can leave other file formattings in place.And finally another option, since it's on github, you could add a new style definition for highlighted text so we aren't butchering the rest of the formatting. It's nice to have options :)