Our Blogs

Working with EditorConfig in Visual Studio 2017

January 15, 2017
1853 Views
Working with EditorConfig in Visual Studio 2017
custom software developmentVisual Studio 2017 has introduced support for the EditorConfig standard. Touted as a main feature in the latest release, the EditorConfig enable developers to specify a coding style. After that they can make use of that style across various editors.

The main advantage of EditorConfig is the defined styles can be stored in a source control system. It will also help yout o avoid being struck with one particular editor's dialog box. Interestingly, Visual Studio 2017 provides support for the EditorConfig feature with C#, Visual Basic, C++, JavaScript, F# and TypeScript.

According to Kasey Uhlenhuth, the main benefit of EditorConfig is that broad standards can be defined solution-wide. Moreover, you can make use of the file to define project or directory specific standards.  If you add the file, you can define not only code formatting but also code style rules.

As of this writing, Visual Studio 2017 provides support for indent_style, indent_size, tab_width, end_of_line and charset formatting rules. The trim_trailing_whitespace and insert_final_newline rules are not supported.

According to Microsoft, the EditorConfig support in Visual Studio will be updated after Visual Studio 2017 RTM. The main goal is to provide full compatibility with EditorConfig features through updates. After you define the various code formatting and code style rules, you can close and reopen any open files during the modification of EditorConfig file. There are keyboard shortcuts such as CTRL-K, D, which you can make use of to apply new rules.

With the capability to define code style rules, you can activate build break depending upon the situation wile integrating the file with Visual Studio 2017.

If you have access to Visual Studio 2017, you should test drive the EditorConfig file to unleash the full potential.