Download this extension from the VS Marketplace or get the CI build.
The EditorConfig Project helps developers define and maintain consistent coding styles between different editors and IDEs.
Visual Studio 2017 natively supports .editorconfig files, but it doesn't give language support for editing those files. This extension provides that
For Visual Studio version 2010 to 2015, get the EditorConfig extension instead.
See the change log for changes and road map.
Need help getting started with commands? Check out Microsoft's Reference Guide for details and examples of coding styles available
- Makes it easy to create .editorconfig files
- Syntax highlighting
- C# and .NET style analyzers
- Intellisense
- Code snippets
- Validation
- Hover tooltips
- Light bulbs
- Code formatting
- Navigational drop downs
- Inheritance visualizer
- Settings
- Brace completion
- Brace matching
- Comment/uncomment
- Outlining (code folding)
- Drag 'n drop file onto .editorconfig file
To make it really easy to add a .editorconfig file, you can now right-click any folder, project, solution folder and hit Add -> .editorconfig File
Full colorization of the full .editorconfig syntax.
Visual Studio 2017 lets you add C# and .NET specific rules to the .editorconfig file. In addition to enabling various rules, a severity is also added to control how Visual Studio is going to handle these rules.
Each severity is clearly marked by an icon to make it easy to identify.
The extension provides Intellisense for both keywords and values.
Various code snippets have been added to make it easier to work with .editorconfig files.
To insert a snippet, right-click inside the editor or hit Ctrl+K,Ctrl+X.
This will show a list of available snippets to insert.
Error squiggles are shown for invalid values.
Properties that are being overridden by a duplicate property in the same section is easy to identify.
If a parent document contains the exact same property and value in a section with the same globbing pattern, a suggestion shows up to remove it.
See the complete list of error codes.
To suppress any error in the .editorconfig document, use the light bulb feature:
That will add a special comment at the top of the file to let the validator know what error messages to suppress.
Another way to suppress the error is by right-clicking the error in the Error List.
Hover the mouse over any keyword to see a full description.
Sorting properties, deleting sections, and adding missing rules is easy with the commands being shown as light bulbs in the editor margin.
Typing Ctrl+K,D
will invoke Visual Studio's Format Document command. By default that will align all the equal (=
) delimeters and add 1 space character around both equal- and colon characters. This behavior is configurable in the settings (see below).
Dropdown menus at the top of the editor makes it easy to navigate the document.
A project can have multiple .editorconfig files and the rules in each cascades from the top-most and down. It is based on folder structure.
The inheritance visualizer is located at the bottom right corner of the editor window and makes it easy to see this relationship.
You can navigate to the immediate parent document by hitting F12. You can change the shortcut under Tools -> Options -> Environment -> Keyboard and find the command called EditorConfig.NavigateToParent.
Note, the inheritance visualizer is only visible when the current file isn't the root of the hierarchys or by specifying the root = true
property.
Change the behavior of the editor from Tools -> Options or simply by right-clicking in the editor.
Check out the contribution guidelines if you want to contribute to this project.
For cloning and building this project yourself, make sure to install the Extensibility Tools 2015 extension for Visual Studio which enables some features used by this project.
References to available formatting/code options directly from Roslyn codebase