Skip to content

Latest commit

 

History

History
159 lines (101 loc) · 7.16 KB

README.md

File metadata and controls

159 lines (101 loc) · 7.16 KB

EditorConfig

Build status

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

Features

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

Classification

Full colorization of the full .editorconfig syntax.

Classification

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.

C# and .NET style analyzers

Each severity is clearly marked by an icon to make it easy to identify.

The extension provides Intellisense for both keywords and values.

Classification

Classification

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.

Snippets

This will show a list of available snippets to insert.

Snippets

Error squiggles are shown for invalid values.

Classification

Properties that are being overridden by a duplicate property in the same section is easy to identify.

Validate duplicates

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.

Validate parent

See the complete list of error codes.

To suppress any error in the .editorconfig document, use the light bulb feature:

Suppress error

That will add a special comment at the top of the file to let the validator know what error messages to suppress.

Suppress Comment

Another way to suppress the error is by right-clicking the error in the Error List.

Suppress from Error list

Hover the mouse over any keyword to see a full description.

Classification

Sorting properties, deleting sections, and adding missing rules is easy with the commands being shown as light bulbs in the editor margin.

Light bulbs

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).

Code formatting

Dropdown menus at the top of the editor makes it easy to navigate the document.

Navigational drop downs

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.

Inheritance visualizer

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.

Open EditorConfig settings

Settings

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

Apache 2.0