views:

73

answers:

2

I just installed CodeRush Pro (evaluation trial) for Visual Studio and I can say I like it much so far. Comparing to Resharper there is only one type of feature I'm really missing. It is the way CodeRush deals with using. When I type some class name that is not declared in some package listed in using, CodeRush underlines it red as an error(what it is) but if I hover over it with cursor it does not offer me to add using, it merely says it is "Undeclared element".

I have to use VS default using addition (move caret to the identifier, hover cursor over that really small box that appears under first letter, click the button that appears and choose for example using System form a drop down menu).

Is there a way how to configure CodeRush to offer mi add using when I hover a cursor over highlighted "issue"(that says Undeclared element)?

The second part of this is that Resharper has somethink called Type name completion. It some improved intellisense. Lets say you have no using declaration in your file. Then you type something like ICompar and press CTRL+SPACE. Of cause there will be no suggestions. But with Resharper you can press CTRL+ALT+SPACE and you get suggestions of all classes starting with ICompar even if they are not in using. When you choose one of them the correct using is automatically added for you.

Is there a way to make CodeRush behave this way ?

+3  A: 

PART I

Visual Studio

The default VS mechanism you mention is tripped using Ctrl+Period or Shift+Alt+F10

CodeRush Templates

Let me quote Mark Miller (Chief architect of CodeRush) for this part:

"CodeRush templates (like VS code snippets on steroids) will add namespaces as needed, so if you use templates to create classes, methods, variables, properties, events, and type references then the namespace references will be added automatically and you'll rarely need to use the VS feature for adding namespaces. To get started with the templates we recommend docking the CodeRush training window (DevExpress | Tool Windows | CodeRush) to the side of the editor and check that training window for tips and templates you can use to generate the code you need. Just type the template as it shows up in the window and expand it using the space bar."

Try the v-series, the m-series, the n-series and the t-series.

So what I mean by this is:

  • Launch the CodeRush training window (DevExpress\Tool Windows\CodeRush)
  • Dock it to the left
  • Back to the editor
  • Type 'v' (no quotes)
    • Careful this is context sensitive
      • Try this whilst the caret is in a class.
      • Try this whilst the caret is in a method.
  • Now look at the Training window.
  • You should see a few suggestions of further characters to type.
  • Type one of the suggestions and then hit space.

That was your introduction to the v-series of templates.

Feel free to check out the m-series, the n-series and the t-series.

Also note that the training window also provides suggestions when you are on a blank line.

Community Plugins

There is nothing built into CodeRush which provides "Add using for this type" functionality.

However there are numerous Community Plugins which add all sorts of functionality to CodeRush. This extensibility is one of the best features of CodeRush.

One plugin in particular Refactor_Resolve has functionality that might come close to what you describe.

PART II

I don't believe there are any intellisense enhancements provided by CodeRush at this time.

Sorry

Rory Becker
Well what about some plug-in to enhance default VS intellisense ?
drasto
Dear Rory, I've spent some hours googling and reading through tutorials. First of all: Refactor_Resolve does not work. There is a comment in discussion that says that it does not work and I does not work for me either. Second, it should be easy to code extension like the one I need (and I'm not alone - this staff would please a lot of developers I'm sure of that). As you very well know it's child's play to extend CodeRush. But there are some staffs I don't know how to code: http://stackoverflow.com/questions/2886369/getting-all-the-classes-in-project-and-their-packages-from-coderush-extension
drasto
I will look into what isn't working with Refactor_Resolve, this weekend. I will also have a look and see if I can provide you with what is needed for your other question.
Rory Becker
Ok I've managed to patch Refactor_Resolve for DXCore 10.1. API changes had prevented this plugin from operating correctly. Please try build 1264
Rory Becker
Well done, Refactor_Resolve works now. It is very close to what I was asking for indeed :)) However it still does not show fix option in issue pop-up. And I would say it's shouldn't be refractoring - it does change what the code does so I guess this should be code provider not refractor...
drasto
+1  A: 

Not an answer, but giving my best poor mans crap workaround in case there isnt a better one... is Ctrl-Home (top of file) then usl and <space> (expand to using System.Linq) then Ctrl-Minus(Back to where we were - of course you can use the CR markers too).

(I have a request in the CR bugbase for this to be sorted)

Ruben Bartelink