Rory Becker - DevExpress CodeRush Blog

July 2011 - Posts

  • New Plugin: CR_StringFormatter

    Another CodeRush Feature Workshop (Part 1 and Part 2) has yielded a plugin, and this one is truly awesome.

    String Formatter works in 3 separate ways to increase your productivity:

    Tab to Next Reference Extension

    Tab among references to a string token and variable/expression whose value will replace it at runtime.

    Simply place the caret on a String.Format token (ie {0}) and then press the Tab key.

    The Tab to Next Reference engine is engaged, and the user may now tab between references to the token, and the argument which will be used to fill it at run-time.

    Note: For now, this new Tab To Next Reference functionality will require the presence of our previous CR_PrimitiveTab plugin and it’s required configuration. We hope to address this in a future version of CodeRush.

    CodeIssue - Format Item Index Too Large

    Wouldn’t it be useful, if studio could let you know when you reference a token inside a String.Format, but then fail to supply a corresponding argument to fill it. The “Format Item Index Too Large” CodeIssue, highlights when the index of a token in a String.Format string references an argument which is not present.

    In this example, note how the string contains references to 3 distinct tokens, {0}, {1} and {2}. However there are only 2 further arguments.


    This will crash at runtime and Studio does nothing to warn you of this. CR_StringFormatter to the rescue…

    See below, how CR_StringFormatter’s CodeIssue highlights the offending token as an error, and provides a message to help you understand what is wrong..


    The ‘Format String’ Builder

    Do you have all the FormatString notations memorized? You do ? … Really? … Wow.. Well good for you.

    I don’t… Sad smile 

    …but then l I don’t need to. I have CR_StringFormatter Open-mouthed smile

    [Are you ready? This is even more awesome than the first 2 bits.]

    The 3rd piece of awesome productivity that CR_StringFormatter provides you with, is a Format String Builder. This is a context sensitive FormatString Builder dialog.

    It’s like our Color swatch dialog, only for format strings and is is available when the your caret is within a String.Format token. (ie {0})

    Simply choose "Format Item..." from the Code SmartTagMenu. 



    When “Format Item…” is chosen, the user is presented with a dialog designed to aid them in the building of a Format String suitable for their needs.

    This dialog works with String, Ints, Real (floating point) numbers , Dates and Times. Depending on the type of data being dealt with, you can expect to be given help with alignment, leading or trailing zeros, decimal places, currency, hex conversion and more.

    Go on, drink it in…


    Upon acceptance, this carefully crafted string will replace the original token in the string from which the dialog was requested.

    Isn’t that awesome. Yet more information that you don’t have to remember (or go look up) every time you need it.

    Now download from the community site, and be sure to keep an eye out for more CodeRush Feature Workshops

  • Tab through Primitives for CodeRush

    Introducing CR_PrimitiveTab. The result of another CodeRush Feature Workshop

    This plugin extends Tab to Next Reference, allow you to navigate among references to primitives, of the same value, in the same file.

    For example: If you place your caret on the number 10 within a code file, and then hit the Tab key, you will immediately begin tabbing through all the other instances of the number 10 within that file.


    The same will also works for strings, dates, floats and other primitive values.

    This is a great way to get a feel for how many instances of a given literal are referenced, and under what circumstances. It’s a useful scouting tool. Useful just prior to the introduction of a constant or just as a way to navigate to something similar in the same file.

    A Small Reconfiguration
    Due to the way the current version of Tab to Next Reference works internally, it will be necessary to perform some small reconfiguration of the settings, in order for this plugin to work.
    You will need to add the Editor\Code\InPrimitive context to the Shift+Tab, Tab, and Shift+Alt+U. These bindings can be found in the Navigation\References\Nav Fields folder of the Shortcuts Options Page.

    We are hoping to address the need for this tweak in a future version of CodeRush.

    So what are you waiting for? Go grab this amazing new feature from the Community Site.

    Be sure to keep an eye out for more CodeRush Feature Workshops


Chat is one of the many ways you can contact members of the DevExpress Team.
We are available Monday-Friday between 7:30am and 4:30pm Pacific Time.

If you need additional product information, write to us at or call us at +1 (818) 844-3383


DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, Delphi, HTML5 or iOS & Android development. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

Copyright © 1998-2018 Developer Express Inc.
All trademarks or registered trademarks are property of their respective owners