Possible feature?: Code Inspections from Obsolete attribute

I was just thinking, it would be nice to have some sort of way to embed suggestions in obsolete attributes.

For example, something like this:

[Obsolete(@"Use GetMe instead.
< $this$.GetMyName()
> $this$.GetMe().Name
")]
public string GetMyName() {...}

public User GetMe() {...}


Obviously it wouldn't work for all usages of Obsolete, but for those that it would and is used for, it could provide a much better user experience. Those of us that are writing libraries for others could use this to make it easier for our users to update. I don't know what a good syntax for this would be but I imagine it would be something that deserializes into a code inspection and serializes into something mostly readable. This way when the class is loaded up by resharper these inspections could be added to the code inspections list.

There could also be an action list item for the obsolete attribute which would open the code inspection pattern editor for an easier to edit version than the raw text of the obsolete attribute.

2 comments

I think this is a wonderful idea.  The syntax could be the same as is used for structural search and replace.  But it need not be restricted to Obsolete attributes.  Obsolete does not take into account class interactions like a structural search pattern is capable of.  Search patterns are already serialized as xml (see your .resharper file).  I suggest embedding that xml directly into an assembly, probably as a resource with a well known name.

With this feature libraries like NUnit could embed hints and suggestions for moving between versions, or just switching between alternate-but-equivalent syntax options (i.e, Assert.AreEqual(a,b) and Assert.That(b, Is.EqualTo(a))).

0

Hello Bill,

Thank you for suggestion! I've logged a feature request: http://youtrack.jetbrains.net/issue/RSRP-204469
and you're welcome to monitor its status.

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

http://devnet.jetbrains.net/message/5283270#5283270



0

Please sign in to leave a comment.