CodeRush for Visual Studio – New Options Layers

CodeRush has recently changed the way it reads and processes your options, adding new layers which make it much easier to bind settings to a particular solution or team. This post will explain those changes and show how you can get the most out of this new functionality.

How did Options previously work?
CodeRush used to just store a single set of options in a single place.
This made is easy to backup your options and take them with you, or have them easily replicate to different physical locations (Office, Home, Laptop)

While this on its own is awesome, we wanted to do more.

For example, you might want to:

  • Share options with team developers working on the same solution. It's always helpful if as many people as possible can create and manipulate code according to a single standard and set of pre-configured tools.
  • Use different options for different solutions. Not everyone works for a single employer or sits on a single team where standards are universally agreed. Also, it often makes sense to have the same Template Name Variable shortcut reference different classes in different solutions (for example, you might want "bb" to reference your custom "BigBus" class in one solution, while referencing your custom "BelgianBeer" class in another).
  • Override select team options, templatesshortcuts, etc. on a personal basis. 

How do the new settings work?
The new Options layer lets you create and easily manage multiple sets (or partial sets) of options layers, which we combine at the appropriate times to provide you with a truly seamless experience.

We pull options from at least three distinct layers and compose them for you so that you get the experience you need.

The three layers are:

Solution Personal Options: This is the first place CodeRush looks for options. If it finds that you have personally overridden an option, it looks no further and applies that option to your session. These options are found within the ‘.cr\personal’ folder in your solution folder. Note: if you use these options, your personal overrides should be excluded from source control. These are intended to represent your personal preferences on the given solution, and as such, it's probably a good idea to NOT force them on your colleagues. 

Solution Team Options: Assuming no Solution-based Personal override options are found, CodeRush looks to the Solution-based Team options. These are found within the ‘.cr\team’ folder beneath your solution folder. Note: Now this folder we do recommend adding to source control, so that team options can percolate throughout everyone on your development team.

Team settings are a great place to establish a consistent coding style. Variable naming conventions, brace positioning, indentation style and other vitally important determinations make sense here.

Personal Options: If CodeRush does not find any Solution-based options (personal or team) , then it will look at your traditional CodeRush settings. I like to think of this as the machine level options, since I’m the only one who uses my machine.

There's actually a fourth layer, which are the default settings that come with CodeRush out of the box.

So how do I modify the options in each of these layers?

I’m so glad you asked.

As always, your options can be accessed from the CodeRush | Options... menu.

CodeRushMenuOptionsHighlightedTornEdge

When you reach the Options Dialog, you will notice a new section at the bottom allowing you to indicate which layer to save any current option changes. This defaults to your Personal Options layer. This is the same location where previous versions of CodeRush have saved their options.

OptionsQuickSetupPersonalOptionsHighlightedTornEdge

Options Layers

Alternatively (and perhaps more interestingly), you can visit the options by way of our new Options Layers... menu option:

CodeRushMenuOptionsLayersHighlightedTornEdge

This will present you with our new Options Layers window.

CodeRushOptionsLayersScreen

Each of the listed entries in this window, when double-clicked, will launch the CodeRush Options dialog but only targeted at the layer in question, allowing you to see options at only that layer (and default values from layers below) and alter them in isolation for that targeted layer.

When the Options Dialog is launched in this manner, the previously-mentioned "Layer to save changes:" option will be gone. And there will be an additional section at the top left of the dialog, which will show you the currently targeted layer, as well as its physical location on disk.

CodeRushOptionsPersonalOptionsHighlighted

When you save options in a dialog launched in this manner, the changes you make are only saved in the that targeted layer.


Custom External Option Sets

Obviously it would be a bit of a pain to have to setup your personal navigational options for each and every solution, so we give you the facility to add your own layers which are a higher priority than those that we ship.

If needed, you can create one or more independent folders containing personal overrides which you can store outside (independent of) any single solution, and attach it to one or more solutions, rather like enabling one or more sets of StyleCop rules.

To add a new custom layer:

  1. Open the Options Layers dialog.
  2. Select the layer you would like to override.
  3. Click the "+" button.

    OptionsLayersWithPersonalOverridesAddHighlightedWithTornEdge
  4. Specify a folder. Either an empty one to store new settings, or a folder with pre-existing settings. 

    OptionsLayersPickNewFolder

At this point you’ll have several layers of options each contributing to your CodeRush experience:

  1. Personal Options – Your default CodeRush options held at the user level for any given machine.
  2. Solution Team Options – The options that you wish to impose on a team working on this solution, held within the ‘.cr\team’ subfolder underneath your solution.
  3. Solution Personal Options – Your personal overrides for this particular solution, held within the ‘.cr\personal’ subfolder underneath your solution.
  4. CodeRush Personal Settings – A prebuilt collection of settings that you prefer to be in place for a selection (but not necessarily all) of your solutions. these can be located anywhere convenient (like say a Dropbox or OneDrive folder).

So now you should have everything you need to operate with the correct settings under all circumstances. We hope you enjoy the new layers options, and if you have any questions don't hesitate to ask!

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.