Have you ever tried to work on someone else’s code and realized that they have completely different code formatting than you are used to? Maybe they use tabs, 2 spaces, or 4 spaces for indentation. Maybe they use underscore prefixed private member variables such as
private string _name;
Wouldn’t it be nice if when you pulled down the project from source control, it also brought all of the code formatting styles with it? That’s what EditorConfig is meant for.
Not long ago I added an
.editorconfig file to RogueSharp. I recently mapped all of the ReSharper settings to the config as both Visual Studio and ReSharper come bundled with native support for EditorConfig.
First you’ll need to download the file. I created a public Github Gist which is available here:
Add to Solution
- Copy the downloaded file to the root of your solution where the .sln file lives.
- Make sure that the name is
- Create a new
Solution Itemsfolder in Visual Studio if it doesn’t already exist
.editorconfig will work as is, you’ll likely want to make some modifications to it, to match your coding style.
- tabs vs spaces
- indent size
- trim trailing whitespace
You’ll likely want to change the indent size at a minimum. At TechSmith where I am currently employed we use 3 spaces, but 2 or 4 is more typical.
.NET Language Conventions
.NET Formatting Conventions
.NET Naming Conventions
Note: I organized the ReSharper settings according to how they appear in the menus. There should be a 1-1 relationship between each
.editorconfig setting and it’s corresponding ReSharper menu entry.
Faron Bracy is a husband, father, and TechSmith employee. He maintains the open source library RogueSharp as a hobby project. Other hobbies include painting fantasy miniatures, playing board games, and playing retro video games with his family.