New CodeRush Plugin – TemplateExpandWithCollapsedRegions


Yes I know. Regions are bad. Regions are awful. Regions should be shot repeatedly until dead. Try to bear in mind that not everyone views everything the same way, and openness to alternatives is a good thing. For the purposes of this blog post, I’m going to ignore the fact that some people see regions as a bad thing. The customer asked for this functionality. Hopefully it will be useful. For the benefit of the customer in question, I’m going to try to keep them relatively anonymous :)

No regions were harmed in the making of this plugin. Sorry.

Customer Request (Paraphrased for security reasons)

I love CodeRush Templates. Is there a way to have CodeRush expand a template, but leave regions that it generates collapsed?

Short answer: No, there’s nothing built in. Sorry.

Longer Answer: That sounds like a challenge. Let me see what I can do.

TemplateExpand with Collapsed Regions

When you expand a template in CodeRush, your space (or sometimes Tab) key is firing our TemplateExpand command. This in turn invokes all sorts of clever magic and emits text and other things into your editor, with considerably less effort on your part, than if you’d had to type it all yourself.

This new plugin provides a single new (alternative) command TemplateExpandWithCollapsedRegions.

To use it, simply bind it to a shortcut of your choice. In testing I have bound it, as I usually do, to Ctrl+T. You can of course pick anything you like. You may even decide you like it so much that you want to replace the original TemplateExpand command. If that’s the case then you’ll need to locate the existing binding on the shortcuts page, and alter the command from TemplateExpand to TemplateExpandWithCollapsedRegions.

Once you have assigned this command to a shortcut you can use it just like the original command.

This latest version of this plugin can be found on github.
Feel free to download, install it and see what you think Smile

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.