Thursday, February 25, 2010

Improve the Speed of CodeRush: EdgeCase Scenario

I have *one* solution on *one* machine on which CodeRush runs slow.

Dog slow…

Lame-Dog slow

So slow it’s painful and I was forced to unload (not uninstall … don’t be daft) CodeRush.
This is also painful, but in my view there was simply no alternative.

Seriously I’ll happily explain if it’s really needed, but no… Resharper is not, for me, a valid alternative.

This has been the case for nearly 2 weeks. This problem as I say, affects only a single solution and not all files in it… But enough of them to cause me some serious headaches.

Yesterday I cured it. [Cue Choir of angels… lights from heaven … General merriment from all]

How did I do this.. Well to cut an already long story short…

I *un*installed StyleCop 4.3.3.0, restarted Studio and loaded my solution

The effect was immediate… like a bolt of lightning turning night into day. however unlike a bolt of lightning, the effect was permanent. This offending solution has now been made into CodeRush’s whipping boy and frankly my entire week is looking up :D

I have handed support all the information I can find which might help eliminate this issue and I’m sure they’ll soon find out what’s going on…

In the mean time I’m writing this post in the hopes that others who might have tried CodeRush and found it to be slow (I’m sure there aren’t that many :D) might find this or be pointed at it by colleagues and perhaps give it another spin with this in mind.


Thursday, February 18, 2010

Enhance QuickNav (CodeRush or CodeRush Xpress)

Update: DevExpress have removed the QuickNav feature from CodeRush Xpress 10.1 and higher (when used under VS2010) at the request of Microsoft. It is believed that this is because it overlaps in functionality with one of the VS2010's new features. Since Microsoft licensed CodeRush Xpress on behalf from DevExpress for all users of VS2008 and VS2010 (Pro and above), this is not completely unreasonable. This feature remains in the Pro version of CodeRush


QuickNav (Ctrl+Shift+Q) is an often overlooked but useful tool in the CodeRush (and Xpress) box.

With it you can search through your code pretty quickly… provided, that is, you configure it for the type of search you’re trying to do.

QuickNavigation

I don’t know about you but I often go kinda snow blind looking at all those icons for “Public property”, “Friend Method”, “Private Class”

However what very few people seem to know, is that you can preconfigure QuickNav to behave differently based on how you launch it.

That’s right you can create your own shortcuts (keystrokes) to launch QuickNav preconfigured for a specific type of search.

By adding just a couple of keystrokes, QuickNav can become IMHO a much more useful facility.

The 2 shortcuts I’m going to suggest I’m going to call “Find Types in Solution” and “Find Types and Members in File”. These are more descriptions of what they will do, rather than the names they will be given.

To add these shortcuts, follow the instructions in my previous post Binding a key in CodeRush and enter the information below in the appropriate boxes. At this point you will have added 2 very useful tools to your box o’ tricks

Find Types in Solution
Bind to : Suggest Ctrl+T
Command: QuickNav
Params: AllTypes, , AllVisibilities, CurrentSolution

Find Types and Members in CurrentFile
Bind to : Suggest Ctrl+M
Command: QuickNav
Params: AllTypes, AllMembers, AllVisibilities, CurrentFile

These bindings should allow you to navigate your code even easier than before :)

For reference, I will now quote from an early forum post by AlexS in which he details the possible parameters for the QuickNav command

-------------------------------------------------------------
There are 4 parameters for the QuickNav action:

TypeFilter -- defines default type filter for the Quick Navigation.
Use the following values to setup default type filter: Classes, Interfaces, Structs, Enums, Delegates, AllTypes.
Use "and" keyword to combine filters together like this: Classes and Structs
MemberFilter -- defines default member filter for the Quick Navigation.
Use the following values to setup default member filter: Methods, Properties, Events, Fields, LocalsAndParams, AllMembers.
Use "and" keyword to combine filters together like this: Methods and Properties.
AccessFilter -- defines default access filter for the Quick Navigation.
Use the following values to setup default access filter: Private, Protected, Internal, ProtectedInternal, Public, AllVisibilities.
Use "and" keyword to combine filters together like this: Private and Protected.
LocationFilter -- defines default location filter for the Quick Navigation.
Use the following values to setup default location filter: AllFiles, CurrentSolution, CurrentProject, CurrentNamespace, CurrentFile.
You can not use "and" keyword here to combine filters together.
Here are examples of parameters usage:

AllTypes, AllMembers, AllVisibilities, CurrentFile
AllTypes, AllMembers, AllVisibilities, AllFiles
AllTypes, AllMembers, Public and Protected, CurrentFile
-------------------------------------------------------------