I've spent some time trying to find a way CodeRush could add using when it finds undeclared element that is in the fact class name with no using added. The solution suggested in this answer to my question (Refactor_resolve) does not work (bugged?).
In a process I found out that writing plug-ins for CodeRush is easy, so I decided to code this functionality myself (and share it). I'd only implement a CodeProvider
(like in this tutorial). The only thinks I need to do the job are answers to this questions:
At the start up of my plugin I need to get a list (set, map, whatever) of all classes and their packages. This means all the classes(interfaces...) and their packages in project, and within all referenced libraries. And I also need to receive updated on this (when user adds reference, creates new class). Can I get this from some CodeRush classes or maybe VS interface available from
CodeProvider
class?How do I add created
CodeProvider
to the pop-up that is shown when user hovers over an Issue?
BTW, it looks like Rory has fixed some bugs in the "Refactor_Resolver" plug-in and it works now. As for your questions here's a quick reply:
RE #1:
CodeRush has a built-in cache for all types, project references, etc that is built while the solution is parsing. But at the moment it is used internally and not exposed for plug-in devs, sorry. However, here are some useful APIs to get started with:
To get assembly references cache, use a ScopeManager (located in DevExpress.DXCore.MetaData.dll), e.g.
RE #2: To add a CodeProvider to the pop-up set its "CodeIssueMessage" property to the name of the code issue to fix, e.g.
myCodeProvider.CodeIssueMessage = "Undeclared element";
Let me know if you need further assistance.