Skip to content

Instantly share code, notes, and snippets.

@DanielRose
Forked from sliekens/TypeMemberLayout.xaml
Last active June 29, 2018 15:36
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save DanielRose/e59777c0d47d0d4aa94a to your computer and use it in GitHub Desktop.
Save DanielRose/e59777c0d47d0d4aa94a to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-16"?>
<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
<TypePattern DisplayName="COM interfaces" Priority="2000">
<TypePattern.Match>
<And>
<Kind Is="Interface" />
<Or>
<HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" />
<HasAttribute Name="System.Runtime.InteropServices.ComImport" />
</Or>
</And>
</TypePattern.Match>
</TypePattern>
<TypePattern DisplayName="P/Invoke structs" Priority="2000">
<TypePattern.Match>
<And>
<Or>
<Kind Is="Struct" />
<Kind Is="Class" />
</Or>
<HasAttribute Name="System.Runtime.InteropServices.StructLayoutAttribute" />
</And>
</TypePattern.Match>
</TypePattern>
<TypePattern DisplayName="P/Invoke classes (xxxNativeMethods)" Priority="2000">
<TypePattern.Match>
<And>
<Kind Is="Class" />
<Name Is=".*NativeMethods" />
</And>
</TypePattern.Match>
</TypePattern>
<TypePattern DisplayName="DataMembers" Priority="2000">
<TypePattern.Match>
<And>
<Or>
<Kind Is="Field" />
<Kind Is="Property" />
</Or>
<HasAttribute Name="System.Runtime.Serialization.DataMemberAttribute " />
</And>
</TypePattern.Match>
</TypePattern>
<TypePattern DisplayName="NUnit Test Fixtures" Priority="2000">
<TypePattern.Match>
<And>
<Kind Is="Class" />
<HasAttribute Name="NUnit.Framework.TestFixtureAttribute" Inherited="True" />
<HasAttribute Name="NUnit.Framework.TestCaseFixtureAttribute" Inherited="True" />
</And>
</TypePattern.Match>
<Entry DisplayName="Setup/Teardown Methods">
<Entry.Match>
<And>
<Kind Is="Method" />
<Or>
<HasAttribute Name="NUnit.Framework.SetUpAttribute" Inherited="True" />
<HasAttribute Name="NUnit.Framework.TearDownAttribute" Inherited="True" />
<HasAttribute Name="NUnit.Framework.FixtureSetUpAttribute" Inherited="True" />
<HasAttribute Name="NUnit.Framework.FixtureTearDownAttribute" Inherited="True" />
</Or>
</And>
</Entry.Match>
</Entry>
<Entry DisplayName="All other members" />
<Entry DisplayName="Test Methods" Priority="100">
<Entry.Match>
<And>
<Kind Is="Method" />
<HasAttribute Name="NUnit.Framework.TestAttribute" />
</And>
</Entry.Match>
<Entry.SortBy>
<Name />
</Entry.SortBy>
</Entry>
</TypePattern>
<TypePattern DisplayName="StyleCop Layout" RemoveRegions="All" Priority="1000">
<TypePattern.Match>
<Or>
<Kind Is="Class" />
<Kind Is="Struct" />
<Kind Is="Interface" />
</Or>
</TypePattern.Match>
<Region Name="Constants">
<Entry DisplayName="Constants">
<Entry.Match>
<Kind Is="Constant" />
</Entry.Match>
<Entry.SortBy>
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Name />
</Entry.SortBy>
</Entry>
</Region>
<Region Name="Static Fields">
<Entry DisplayName="Static fields">
<Entry.Match>
<And>
<Kind Is="Field" />
<Static />
</And>
</Entry.Match>
<Entry.SortBy>
<Kind Order="Constant Field" />
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Readonly />
<Name />
</Entry.SortBy>
</Entry>
</Region>
<Region Name="Fields">
<Entry DisplayName="Fields">
<Entry.Match>
<Kind Is="Field" />
</Entry.Match>
<Entry.SortBy>
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Readonly />
<Name />
</Entry.SortBy>
</Entry>
</Region>
<Region Name="Constructors and Destructors">
<Entry DisplayName="Constructors and Destructors" Priority="200">
<Entry.Match>
<Or>
<Kind Is="Constructor" />
<Kind Is="Destructor" />
</Or>
</Entry.Match>
<Entry.SortBy>
<Static />
<Kind Order="Constructor Destructor" />
<Access Order="Public Internal ProtectedInternal Protected Private" />
</Entry.SortBy>
</Entry>
</Region>
<Region Name="Delegates">
<Entry DisplayName="Delegates">
<Entry.Match>
<Kind Is="Delegate" />
</Entry.Match>
<Entry.SortBy>
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
</Region>
<Region Name="Public Events">
<Entry DisplayName="Public events">
<Entry.Match>
<And>
<Kind Is="Event" />
<Access Is="Public" />
</And>
</Entry.Match>
<Entry.SortBy>
<Access Order="Public" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
</Region>
<Region Name="Explicit Interface Events">
<Entry DisplayName="Interface events">
<Entry.Match>
<And>
<Kind Is="Event" />
<ImplementsInterface />
</And>
</Entry.Match>
<Entry.SortBy>
<ImplementsInterface Immediate="True" />
<Name />
</Entry.SortBy>
</Entry>
</Region>
<Region Name="Events">
<Entry DisplayName="Other events">
<Entry.Match>
<Kind Is="Event" />
</Entry.Match>
<Entry.SortBy>
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
</Region>
<Region Name="Enums">
<Entry DisplayName="Enums">
<Entry.Match>
<Kind Is="Enum" />
</Entry.Match>
<Entry.SortBy>
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Name />
</Entry.SortBy>
</Entry>
</Region>
<Region Name="Interfaces">
<Entry DisplayName="Interfaces">
<Entry.Match>
<Kind Is="Interface" />
</Entry.Match>
<Entry.SortBy>
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Name />
</Entry.SortBy>
</Entry>
</Region>
<Region Name="Public Properties">
<Entry DisplayName="Public properties">
<Entry.Match>
<And>
<Kind Is="Property" />
<Access Is="Public" />
</And>
</Entry.Match>
<Entry.SortBy>
<Access Order="Public" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
</Region>
<Region Name="Explicit Interface Properties">
<Entry DisplayName="Interface properties">
<Entry.Match>
<And>
<Kind Is="Property" />
<ImplementsInterface />
</And>
</Entry.Match>
<Entry.SortBy>
<ImplementsInterface Immediate="True" />
<Name />
</Entry.SortBy>
</Entry>
</Region>
<Region Name="Properties">
<Entry DisplayName="Other properties">
<Entry.Match>
<Kind Is="Property" />
</Entry.Match>
<Entry.SortBy>
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
</Region>
<Region Name="Public Indexers">
<Entry DisplayName="Public indexers" Priority="1000">
<Entry.Match>
<And>
<Kind Is="Indexer" />
<Access Is="Public" />
</And>
</Entry.Match>
<Entry.SortBy>
<Access Order="Public" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
</Region>
<Region Name="Explicit Interface Indexers">
<Entry DisplayName="Interface indexers" Priority="1000">
<Entry.Match>
<And>
<Kind Is="Indexer" />
<ImplementsInterface />
</And>
</Entry.Match>
<Entry.SortBy>
<ImplementsInterface Immediate="True" />
<Name />
</Entry.SortBy>
</Entry>
</Region>
<Region Name="Indexers">
<Entry DisplayName="Other indexers" Priority="1000">
<Entry.Match>
<Kind Is="Indexer" />
</Entry.Match>
<Entry.SortBy>
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
</Region>
<Region Name="Public Methods and Operators">
<Entry DisplayName="Public methods and operators">
<Entry.Match>
<And>
<Or>
<Kind Is="Method" />
<Kind Is="Operator" />
</Or>
<Access Is="Public" />
</And>
</Entry.Match>
<Entry.SortBy>
<Access Order="Public" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
</Region>
<Region Name="Explicit Interface Methods">
<Entry DisplayName="Interface methods">
<Entry.Match>
<And>
<Kind Is="Method" />
<ImplementsInterface />
</And>
</Entry.Match>
<Entry.SortBy>
<ImplementsInterface Immediate="True" />
<Name />
</Entry.SortBy>
</Entry>
</Region>
<Region Name="Methods">
<Entry DisplayName="Other methods">
<Entry.Match>
<Kind Is="Method" />
</Entry.Match>
<Entry.SortBy>
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
</Region>
<Region Name="Operators">
<Entry DisplayName="Operators">
<Entry.Match>
<Kind Is="Operator" />
</Entry.Match>
<Entry.SortBy>
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Static />
<Name />
</Entry.SortBy>
</Entry>
</Region>
<Entry DisplayName="Nested structs" Priority="600">
<Entry.Match>
<Kind Is="Struct" />
</Entry.Match>
<Entry.SortBy>
<Static />
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="Nested classes" Priority="700">
<Entry.Match>
<Kind Is="Class" />
</Entry.Match>
<Entry.SortBy>
<Static />
<Access Order="Public Internal ProtectedInternal Protected Private" />
<Name />
</Entry.SortBy>
</Entry>
<Entry DisplayName="All other members" />
</TypePattern>
</Patterns>
@Dano7
Copy link

Dano7 commented Apr 26, 2015

Hey thanks! Not using StyleCop at the moment, but I love using the StyleCop Layout with Resharper when I need to do a full clean-up on somebody else's code. I could not figure out the Resharper 9.1 Code Layout UI at all, but I just droped this XAML in and it worked beautifully! Thanks!

@rhysawilliams2010
Copy link

Thanks Dan, this is exactly what I was looking for to map resharper 9 magically fix SA1201 etc.

@collinbarrett
Copy link

Thanks for this! Do you know if this is still fairly up to date with a recent version of StyleCop and ReSharper 2018?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment