Ian's Blog

More on CodeRush/Refactor 2.0

with 3 comments

CodeRush/Refactor is evolving into the tool I want to love, but it’s just not there yet. The templates are tremendously cool (and it’s obvious I’ve barely scratched their surface) but as a whole it’s lacking a number of Resharper features I find it hard to live without.

Some of these were previously mentioned, but this is my complete, updated wish list for CodeRush/Refactor:

  • I need keyboard shortcuts for “Move Down Call Graph” (Go To Definition) and “Move Up Call Graph” (or List References, when there’s more than one possibility). Visual Studio 2005 has only halfhearted implementations of these. For example it doesn’t take overloaded routines into account and it frequently just doesn’t find some references. Visual Studio 2003 is totally lacking the List References/Find Symbol functionality, making this a huge win there. These are what I called “usage search tools” last week. This is a killer Resharper feature that I just can’t live without.
  • I’d like a tool window showing my marker stack that allows visiting any marker with a double-click, without altering the stack. (Maybe add some right-click options and/or drag-n-drop to modify the stack. I could be persuaded that’s overkill.) This would make markers the perfect bookmark replacement, and I could forget about them altogether. As it is, I still have to use bookmarks if there’s a bunch of source locations I need to visit frequently in relatively random order.
  • I’d like additional syntax highlighting options. In particular, I like being able to give colors to variables of different scope (member, local, parameter).
  • I’d like a comprehensive list of keyboard shortcuts, including templates, navigation, embedding, etc. I know the vast majority are context sensitive, and this list would be huge, but I still want it and this is my list. 🙂 At the very least, bring the training panel (which is awesome) up-to-date. Shift-ESC, one of my favorites, isn’t even on there! Good thing I discovered it via the training video!
  • CodeRush needs to do smart overwriting of closing parentheses: another one I got used to in Resharper. With the default options, there are some strange gymnastics required to work around the automatically inserted closing parentheses. For example, attempt to type this line:

    someStringBuilder.Append(someEnumValue.ToString());

    When you type the opening parentheses for ToString, a closing parentheses is added, so now both are in place. However, depending on the strength of your habits, you’re likely to add an extra parentheses or two. Even if you stop, you’ve now got to press End or cursor to the right before pressing enter. (Unless you have “Smart Enter” turned on, which is what I did, but that’s not the default.) Resharper recognizes that there are no more parentheses needed, and automagically overwrites them as you type. I don’t like that with CodeRush I have extra mental gymnastics to examine the parentheses situation at the end of some lines. Again, familiarity would probably make it better but I think Resharper’s solution is a good one: low impact to newbies without sacrificing power. I’m sure someone can point out that I’ve missed an option or “the right way” to type this line, but that’s exactly the point: Resharper doesn’t make me learn a new way to type code (or ship with options that do).

  • The refactor hotkey should have more consistent behavior. You can assign a keyboard shortcut to the context-sensitive refactorings, which is great. The problem is that if there’s only one available refactoring for the current context, it’s automatically performed. For someone relatively new to the product, I’d prefer to see what’s going to happen first. Maybe I’ll change my mind as I get more familiar. Nevertheless, I’d make this an option and default it to the “just pop up, don’t perform” setting to accomodate newbies.
  • I’m getting used to using CodeRush’s QuickNav, which is equivalent to Resharper’s CTRL-N (Go To Type) or CTRL-SHIFT-N (Go To File). The only thing I’d like is being able to change the search scope more easily with the keyboard. I still feel like I could get to ANY file/type quicker with Resharper because I never had to reach for the mouse. Also, Resharper’s list updates as you type, making everything feel snappier.
  • Better availability for some refactorings. Want to “safe rename” a structure? Too bad, it’s not there! You’re stuck with Visual Studio 2005’s icky implementation, or you’re totally out of luck in VS2003.
  • Resharper does background compilation, which lets you see any compile-time errors as you type and improves intellisense. I’m less of a rabid fan of this than many Resharper users, but it is cool. It’s yet another feature that’s less necessary if you work primarily in VS2005, but is killer for VS2003 users.
  • Show me unused variables and unreachable code. Resharper does this.
  • CodeRush lacks brace auto-completion, though it does auto-complete parentheses and square brackets.
  • CodeRush needs contextual help for the options dialogue. There are a ton of options, and this is most definitely a Good Thing for this type of product. As you’d expect, many of these are not self-explanatory. The only way to figure them out, right now, is to experiment.

I’ll continue to keep an eye on CodeRush. Its got real potential, it’s definitely breaking new ground in the UI, but for me it’s not a Resharper replacement. My quick and dirty summary of the differences is this: If you spend most of your time writing lots of brand new code, CodeRush’s templates are very compelling. If you spend lots of time integrating your work with existing code, particularly code written by other people, Resharper’s analysis tools are the bigger win. Typically at my day job, I’m in the latter camp. If you’re an Eclipse zealot who is occasionally forced to work with .NET, you’re going to find Resharper strangely familiar. (I’m not, but I work with a few.)

I was surprised to see people on the DevExpress newsgroups reporting that CodeRush and Resharper can peacefully coexist. Sounds dangerous, but the possibility of having the best of both worlds is so compelling it’s worth a shot.

Advertisements

Written by Ian Olsen

June 27, 2006 at 11:39 am

3 Responses

Subscribe to comments with RSS.

  1. Hi Ian,

    Thanks for the great post. A few comments —

    Call graph nav is coming and I think you’ll like it.

    Marker stack tool window is easy to create as a DXCore plug-in, but probably won’t become a shipping feature. I may create this in an upcoming DXCore training video, but if you want to give this a shot now, let me know or post a question on our DXCore newsgroup — DXCore plug-ins have direct access to the markers on the stack, and it’s easy to create a tool window plug-in to list these. The DXCore newsgroup is here:

    devexpress.public.dotnet.dxcore.plugins

    Located at news.devexpress.com

    For additional syntax highlighting options (including variable highlighting and unused reference highlighting), check out CodeRush customer Rory Becker’s plug-ins, available here:

    http://www.rorybecker.co.uk/

    I’m pretty sure Shift+Esc does show up in the training window, but it only shows up if there are no template suggestions available.

    The ability to show and print all shortcuts is on our to-do list.

    The smart paren/bracket feature has been corrected in the 2.0.2 release (coming real soon), so now if you type the closing paren it will jump over the one automatically inserted (Enter still works to jump over it).

    Your request to show the refactor menu when only one refactoring is available is on our to-do list.

    Likewise, your request for shortcut bindings to the Quick Nav window scope options is on our to-do list.

    The 2.0.2 release will have an early-experience feature (must be turned on in the Refactoring/Rename options page) that will support cross file renaming of structures, classes, enums, enum elements, and members using the great UI that Refactor! pioneered.

    No comment on Background Compilation / Error Highlighting.

    Unused variables shown with Rory’s plug-in mentioned above. Showing unreachable code? Have you actually worked on code where that feature was useful?

    No brace auto-completion in CodeRush, because you never need to type the brace key. Use the b and “b,” templates (“b,” gives you a brace begin/end pair on a single line). The 2.0.2 update includes discoverability for the “b” template. I have not pressed the “{” key in about two years.

    Request for integrated help with the options dialog duly noted.

    Regarding peaceful coexistence among dev tools, that’s a priority for us. So if there’s a problem or conflict with another dev tool, we’ll do everything we can to fix that ASAP.

    Thanks again for the great feedback.

    Mark Miller

    June 30, 2006 at 12:20 am

  2. Good list.

    Shift-F6: In ReSharper, I’m typing a new name and it’s rolling through. In CodeRush, I can create a shortcut to the Refactor menu to ape this behavor (or use the default shortcut), but then I need to choose which refactoring I want to use. I could not find a hook to directly go to the refactoring I want, and that’s just wasted time for me.

    Unit Testing: This is a big feature in ReSharper 2.0, especially with non-VSTS versions stupidly not including a test runner out of the box.

    Formatting Engine: I know you can format code, why can’t I explicitly trigger the same engine to format the whole file using my preferences?!

    Auto-Insert: method stubs and using directives.

    Embedded Templates: The ctrl+alt+j menu is pretty useful for these. I don’t have to mouse or remember a direct shortcut. I use these a lot less than refactorings I guess, or I remember that ctrl+alt+j 5 is my using template, 4 is my region template. I also like ctrl+alt+Insert in ReSharper… need a property or ctor, good wizard nav after that. Probably in my top 10 used ReSharper features

    (I don’t get the b template. Why not just wire that to { by default, wouldn’t that be more intuitive? I too missed the way ReSharper handles braces, brackets and parentheses.)

    If ReSharper and CodeRush ran well together at the same time, I would be happy using each for what it’s best at. In my experience, they don’t play fluidly together, so I have to pick one or the other.

    From reading the DX forums over the years, it seems like too many recurring feature requests are answered with “it’s easy to create a plugin for that”. Really? Okay, so someone create plugins to address everyone of these pieces of functionality, and then I’m interested.

    Anit

    July 7, 2006 at 12:07 pm

  3. If you want to create a binding to a specific refactoring in Refactor!, just pass the name of the refactoring as it appears in the menu to the Refactor command, and bind that to the shortcut you want (e.g., “Refactor(Rename)”). Refactor! Pro has 55 refactorings now and you can expect that number to go into triple digits sometime next year, so shipping a separate key binding for each refactoring we ship simply doesn’t work, and turns out to be a greater burden on the customer than is necessary. That’s why we ship the one-key access, while still giving you the ability to define your own custom bindings for favorite refactorings you use all the time.

    Regarding formatting, CodeRush and Refactor! format the generated code using the language service’s format command (we do nothing beyond that). This allows us to add support for new languages quickly. You can trigger the same engine by using the built-in VS commands Edit.FormatSelection or Edit.FormatDocument. Default bindings for these commands are Ctrl+K,F and Ctrl+K,D, respectively.

    Unit Test — yeah, we don’t have it, and it’s not on our radar to build it. Stick with Resharper if you like that.

    If you want a property or constructor in CodeRush, there are templates for those. For a Property start with “p” and follow it with the mnemonic of the type of the property you want (use the CodeRush training window to get access to all the mnemonics). For a constructor, use the “cc” template.

    Regarding your question of why we use “b” for braces, “b” is much easier to press than “{“. The brace key requires a syncronized shift key that must be held down before you press the “[” key, and released before you press the next key. This synchronization is easy at slow speeds but breaks down as you try to go faster. You are absolutely right that it is less intuitive than the brace, but braces are used all the time and so the savings trump the less intuitive aspect, and so we handle that with discoverability. Now, I do think that wiring up the braces to work just like the parens and brackets is a great idea, it’s just that it’s never occurred to us simply because we are never pressing that key (and you’re the first to point out that there’s a discrepancy). Using “b” for block is also a mnemonic that works well across languages, and that’s one of the things CodeRush is good at — reducing cross language barriers. Once you’re on board with the templates, you can work in a new language with minimal friction.

    I reach a different conclusion regarding the “less than fluid” combination of CR + R# forces you to pick one or the other. I think it simply implies you pick the best features out of each product. Both Developer Express and JetBrains are working to make sure our products work well together. I know it’s very important to Developer Express that work well with any third party tool, and I think it’s safe to assume that JetBrains similarly recognizes the significance of fostering a strong third party tool market for Visual Studio. So if you have a less than fluid experience because of overlapping features, you simply shut off the less desired feature. There are features in Resharper that are great — we’re not denying that. But there are also features in CodeRush and Refactor! that are more efficient than anything you can get anywhere else. If you want the best development experience possible you simply install both products and get them set up so that you leverage the power of each tool’s strongest features.

    Regarding your comment about our excessive response of “It’s easy — build a plug-in” in the DXCore newsgroups, we respond that way for two reasons — one, because it really is easy, and two, because it’s typically a suggestion that is not on our immediate radar. And to our customer’s credit they have created plug-ins that have satisfied their demands for custom functionality. Your requests for method stubs and inserting using directives are a great example — customers have created and shared plug-ins for solving both of those challenges. There is a really cool XML Doc Comment preview window (that shows you the XML Doc Comment as it will appear in the docs live as you work in the code), custom highlighting, custom refactorings and cool new features that enhance the experience in the editor.

    Mark Miller

    July 8, 2006 at 7:46 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: