Monday, March 12, 2007

Coderush Tip #1: Show References

In CodeRush 2.1.3, a feature called "Show References" was added.In CodeRush 2.1.3, a feature called "Show References" was added.

This feature allows one to 'Tab' through all references to a given variable/method. Simply locate your caret within the token of your choice and hit 'Tab'.
Your caret jumps to the next reference to that token in question.

Hit Shift-F12 (The default 'Show References' keycombo) and up pops the References Tool panel, to show you every reference to the given token in your entire solution.

Go on... Try it with int32 and see how quickly it works.

Now I couldn't leave well enough alone, and deciding that even this was too slow. (Sorry Mark :) ), I resolved to find a quicker way to access this functionality.

It was a very simple idea but one that seemed to gel better in my head.

Basically I changed the keystroke that fires this marvellous facility from [Shift-F12] to [Enter].

To paraphrase something that Mark Miller has said a few times.
Why make somebody push 2 keys when they can press 1?

So if you'd care to follow these few instructions, we'll see if we can't make life a little easier and reduce (by a very small measure) the chances of you suffering RSI.
(Note to reader: Actual chance of suffering RSI may increase as a result of taking this advice due to further addiction to CodeRush and hence coding)

1. First locate the 'DevExpress' menu in Visual Studio and select 'Options'
2. Next locate and select from the tree of options on the left, a branch entitled IDE\Shortcuts.
(Rather than remove the [Shift-F12] keystroke, we'll copy it.)

3. Locate the existing Shortcut in Navigation\References and right-click it.
4. Select 'Duplicate shortcut'
5. Select either the original or the duplicate and alter 'Key 1' so that it reads [Enter] (without brackets).
6. Change the context (the tree of checkboxes in the bottom right) to additionally check the 'System\In Nav Field' context.

7. Click 'Ok'

You're all done

Enjoy

Help your (VB6) Code Shine


One of the reasons that I haven't been posting of late, is down to one Warren Sirota. He is the developer behind CodeShine, a refactoring addin for VB6.

Yes that's right. I said VB6....
Codeshine does not attempt to compete on the same level as RefactorPro. Indeed it does not really compete at all, given that DevExpress have no interest in the VB6 space. (A fact I checked over with both Mark Miller and Ray Navasarkian) but it does manage to provide some of the fundamentals that are so hard to do without once you have been exposed to.

I'm talking about... 'Extract Method', 'Extract Function' and 'Introduce Explaining Variable'.

When I first approached Warren about his software I wanted to know if he had any plans to implement any form of 'Rename' (Local, Parameter, Field) or whether I would get any of the source to CodeShine with my purchase.

Although Warren does not generally share the source to his product, he indicated that we might be willing to collaborate somewhat in light of the fact that I was more that happy to contribute any changes back to the primary source for him to include.

And thus we find ourselves at a point at which I have managed (I think) to have produced a fairly workable 'Rename Var' refactoring which can be used to rename a private field, local variable or method parameter from either their declarations or indeed a reference to said variable.

We are undergoing a period of testing now and this refactoring may well make it into the commercial product. (US$74.95 at the time of this Blog post)

I am very excited to be able to help bring this sort of functionality to VB6.

So if you think this facility might be of use to you or you know someone else who might benefit, send them along to http://www.codeshine.com/CodeShine/default.htm and let's see if we can't help your code to shine that little bit more :)

Sunday, March 11, 2007

I've been gone, but I'm back now.

Ok I've not actually been away anywhere, but I haven't blogged properly this year and, without checking, I think it was at least November before that.

I can't believe I haven't blogged in so long. Well my apologies my dear reader (yes you know who you are :) ). I promise to be more forthcoming with the posts in future.

Look out for posts in the near future on....

CI Refactory: Damn this idea looks good. Jay, I'm downloading as I type this.

CodeShine: Best Refactoring program on the market for VB6 (Yes I said VB6)

CodeRush: The main reason I can't believe I haven't blogged in the last 3 months (That Joost post really doesn't count right?) it that I must have been all of the 5th person (outside of Devexpress ), to have used and loved the new additions to Coderush. (Refactor Pro still has a few rough edges but as always these are on the newer features which havn't had time to bed down yet.) Even though I'm the apparently the slowest person to have pointed out the latest CR goodness, I'm sure there are a few tips I can impart here and there that you might not have heard elsewhere.

So.... On with the Blog.......