Method to provide developer hint messages (similar to Obsolete Attribute)

I'd like to be able to provide developers hints when they use a method (class ...) - a wavy line highlight the code, and some text appear on mouseover. This is the effect you get using the Obsolete attribute at the moment - but sometimes the code isn't obsolete, you just want to highlight that it may be used incorrectly.

E.g. [Hint("For performance reasons consider <other method>")]

Using Custom Patterns with a suitable warning allows this, but that's rather clunky to define, and hidden from the code - it'd be great to have an attribute that allowed the same effect.

Is there a way to do this that I haven't spotted?

1 comment
Comment actions Permalink

Hi. ReSharper doesn't offer anything like this out of the box. However, it would be possible to make a plugin that could do this. You can find details on creating plugins in our devguide. You'd want to take a look at implementing a daemon or an element problem analyzer. This would allow you to walk the abstract syntax tree that ReSharper builds, and find any method calls. You can resolve the method call to a method definition and look to see if it is decorated with your attribute, and if so, add the highlight.

Alternatively, you could suggest a feature at https://youtrack.jetbrains.com

0

Please sign in to leave a comment.