Another CodeRush Feature Workshop means another feature.
CR_SuperSiblingNav provides 2 additional NavigationProviders for navigating between sibling Methods and Properties.
Ok so what’s so special about that then? Can’t we just locate the sibling’s next (or previous) sibling and move the caret to the first character of that?
Well yes … we could … but this isn’t SiblingNav, this is SuperSiblingNav (Note: We had to talk Mark down from SuperMegaAwesomeWonderSiblingNav)
SuperSiblingNav doesn’t just move the focus to the next (or previous) member. It also refocuses the caret at the same relative location on that sibling.
Download this plugin and I’ll show you what I mean after some brief setup information.
Having installed the plugin correctly, you’ll need to bind some keys to the Navigate(Member Next) and Navigate(Member Previous) commands with an appropriate context.
We suggest Ctrl+Alt+PgDn and Ctrl+Alt+PgUp. In each case you should bind the shortcut to the Editor\Code\InMethod and Editor\Code\InProperty contexts.
So once you’re setup, usage is pretty simple. Just position your caret within a method or property and invoke one of the navigation commands.
If the name of your starting member is selected, the name of your destination member will be is selected after navigation.
If a parameter was selected before navigation, then a similar parameter will be selected in the destination member upon completion of the navigation.
This works intelligently, which means that if you move from the 3rd parameter of Method1 (and method2 only has 2 parameters), we will select the second parameter of method2. If you further move on from there to method3 (which does have 3 methods) then we will again select the 3rd parameter for you.
Almost any other tracking
In truth, Super Sibling Nav will track just about any sibling relationship.
In this last example, you can see it tracking the selection as you move through several variable initializations. It will track the variable name, and can even track the assigned value.
So CR_SuperSiblingNav can help you navigate amongst sibling items, whilst maintaining the relative selection of text or positioning of the caret.