Skip to content

Commit 7aef6e7

Browse files
committed
Update article on EditorConfig
1 parent c0be2ee commit 7aef6e7

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

docs/ide/create-portable-custom-editor-options.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Define consistent coding styles with EditorConfig
33
description: Add an EditorConfig file to your project or codebase to enforce consistent coding styles for everyone that works in the codebase.
4-
ms.date: 07/07/2025
4+
ms.date: 07/21/2025
55
author: mikejo5000
66
ms.author: mikejo
77
manager: mijacobs
@@ -15,15 +15,17 @@ helpviewer_keywords:
1515
---
1616
# Define consistent coding styles with EditorConfig
1717

18-
To enforce consistent coding styles for everyone that works in a codebase, you can add an `.editorconfig` file to your solution or project. EditorConfig file settings adhere to a file format specification maintained by [EditorConfig.org](https://editorconfig.org). Many code editors and applications support EditorConfig files, including Visual Studio. Because the settings are in a file, they accompany your code, and can be used even outside of Visual Studio.
18+
To enforce consistent coding styles for everyone that works in a codebase, you can add an `.editorconfig` file to your solution or project. EditorConfig file settings adhere to a file format specification maintained by [EditorConfig.org](https://editorconfig.org). Many code editors and applications support EditorConfig files, including Visual Studio. You can use more than one `.editorconfig` file, and you can include them as part of a codebase.
1919

20-
In Visual Studio, EditorConfig file settings take precedence over the various global text editor settings available under **Tools** > **Options** > **Text Editor** > **\[C# | C/C++ | Visual Basic\]** > **Code Style**. You can use an EditorConfig file to tailor each codebase to use text editor settings that are specific to that project.
20+
You can manually populate an EditorConfig file, or automatically generate it based on the code style settings you've chosen in Visual Studio. For more information, see [Add and remove EditorConfig files](#add-and-remove-editorconfig-files).
2121

22-
You can manually populate an EditorConfig file, or automatically generate it based on the code style settings you've chosen in Visual Studio. For more information, see [Ways to add an EditorConfig file](#add-and-remove-editorconfig-files).
22+
When you add an EditorConfig file to your project in Visual Studio, only new lines of code are formatted based on the EditorConfig settings. The formatting of existing code isn't changed unless you run the **Code Cleanup** or **Format Document** commands. For more information, see [Apply code styles](../ide/code-styles-and-code-cleanup.md).
2323

24-
When you use an EditorConfig file, you can still continue to set your own personal editor preferences in the Visual Studio text editor. These text editor settings apply whenever you're working in a codebase without an EditorConfig file, or when the EditorConfig file doesn't override a particular setting. An example of such a preference is whether to use tabs or spaces for the code indent style.
24+
## EditorConfig and code style preferences
2525

26-
When you add an EditorConfig file to your project in Visual Studio, only new lines of code are formatted based on the EditorConfig settings. The formatting of existing code isn't changed unless you run the **Code Cleanup** or **Format Document** commands. For more information, see [Apply code styles](../ide/code-styles-and-code-cleanup.md).
26+
In Visual Studio, EditorConfig file settings take precedence over the various global text editor settings available under **Tools** > **Options** > **Text Editor** > **\[C# | C/C++ | Visual Basic\]** > **Code Style**. You can use an EditorConfig file to tailor each codebase to use text editor settings that are specific to that project.
27+
28+
When you use an EditorConfig file, you can still continue to set your own personal editor preferences in the Visual Studio text editor. These text editor settings apply whenever you're working in a codebase without an EditorConfig file, or when the EditorConfig file doesn't override a particular setting. An example of such a preference is whether to use tabs or spaces for the code indent style.
2729

2830
## Code consistency
2931

@@ -61,7 +63,9 @@ When you add an EditorConfig file to your project or codebase, Visual Studio for
6163

6264
If you remove an EditorConfig file from your project or codebase, you must close and reopen any open code files for the global editor settings to affect new lines of code.
6365

64-
There are a couple of ways you can add an EditorConfig file to your project:
66+
Visual Studio automatically uses EditorConfig files present in a codebase, based on [folder hierarchy](#file-hierarchy-and-precedence).
67+
68+
If there is no EditorConfig file, you can add one to the project using one of the following methods:
6569

6670
- [Automatically generate an EditorConfig file based on your code-style settings](../ide/code-styles-and-code-cleanup.md#code-styles-in-editorconfig-files).
6771

0 commit comments

Comments
 (0)