Christopher Bennage

Sponsors

The Lounge

Wicked Cool Jobs

Syndication

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Prevent ReSharper from Adding Regions to Interfaces

This is really a corollary to a post by Kyle Baley a while back.

Despite my original love affair with regions some years back, that are nothing but noise to me now. Unfortunately, the default behavior of R# is wraps interface implementations in a region. I can understand where this might be helpful, but 90% of the time (in my experience) it is not .

I made a couple of half-hearted attempts to turn it off. It is not obvious in the least. After learning how from Kyle's post though, I thought I'd outline the exact steps.

  • Go to ReSharper | Options
  • In the left explorer pane, find Language | C# | Formatting Style | Type Members Layout
  • Uncheck "Use Default Patterns"
  • A huge nasty XML document appears. As Kyle mentions, Don't Panic.
  • Around line 162 is a section marked by <!--interface implementations-->
  • Within <entry />, remove:
<Group>
    <ImplementsInterface Immediate="true" 
                         Region="${ImplementsInterface} Members"/>
</Group>

Here's the screen shot.

Turning off regions for interfaces in ReShaper

Now you are good to go!


Posted 10-27-2008 1:04 AM by Christopher Bennage
Filed under: ,

[Advertisement]

Comments

Michael wrote re: Prevent ReSharper from Adding Regions to Interfaces
on 10-27-2008 8:06 AM
Thank you so much for that! This feature from Resharper always annoyed me. Cheers
Rob Eisenberg wrote re: Prevent ReSharper from Adding Regions to Interfaces
on 10-27-2008 10:43 AM
Awesome!
Adam Vandenberg wrote re: Prevent ReSharper from Adding Regions to Interfaces
on 10-27-2008 11:21 AM

Thanks for mentioning this, I kept meaning to look into this.

(Just below that section you can do pretty much the same thing to remove regions from nested classes.)

Kyle Baley wrote re: Prevent ReSharper from Adding Regions to Interfaces
on 10-27-2008 1:31 PM
It's worth looking at that entire XML in more detail. It will wreak havoc on any NUnit tests you have if you leave it as is.
Steve Smith's Blog wrote Prevent Resharper From Adding Regions
on 02-03-2010 3:32 PM

A couple of days ago I was annoyed that Resharper was insisting on turning my abstract base NUnit test class with nothing in it but a shared [SetUp] method into a one line class with a collapsed Setup / Teardown region in it.  While I didn’t always

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)

CodeBetter.Com