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.


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


Ruben said...

Great post, got me thinking.

Dont forget there are shortcuts in the nav dialog too (e.g. Shift Alt F which means scQ,saF does a search in file). Of course this remembers the scope for next time which is very different to your tip.

Another one that I only started using recently is Ctrl Alt N for Jump to (not suggesting this is in any way news)

Alex S said...

Thanks Rory for the great post!

Anonymous said...

Good info. Thanks Rory.

Ben Clark-Robinson said...

What is the name of the feature that it overlaps in VS2010? I'd love to have this feature in VS.

Rory said...

VS2010's nearest equivalent to 'Quick Nav' is called 'Navigate To'