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 Xamarin UI Controls

Deliver high-impact native mobile apps with our feature-rich Data Grid, Scheduler, Chart, TabView, Editors, and utility controls. Reserve your free copy today!
Tomas Juricek 3443
Tomas Juricek 3443

Vhy GitHub? The DXCoreCommunityPlugins site is abadoned again?

19 February 2014
Rory Becker (DevExpress)
Rory Becker (DevExpress)

My apologies for the delay in answering you Karel. I was taking the extra time to create what I hope is a better answer to your question than I could otherwise have provided here in the comments.

I hope this helps to allay any doubts you had:

27 February 2014

Please login or register to post comments.