Skip to content

Commit f89f2b1

Browse files
committed
edits
1 parent 6bc2d52 commit f89f2b1

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

docs/ide/code-styles-and-code-cleanup.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ To add an EditorConfig file, see [Ways to add an EditorConfig file](../ide/creat
3636
::: zone-end
3737

3838
::: zone pivot="programming-language-dotnet,programming-language-dotnetf"
39-
For more information on .NET code style settings, see [Code style settings](/dotnet/fundamentals/code-analysis/code-style-rule-options).
39+
For reference information on .NET code style settings, see [Code style settings](/dotnet/fundamentals/code-analysis/code-style-rule-options).
4040
::: zone-end
4141

4242
::: zone pivot="programming-language-cpp"
@@ -88,16 +88,18 @@ Each item in the list shows a preview of the preference when you select the opti
8888

8989
::: moniker-end
9090

91-
Options set in this window are applicable to your Visual Studio personalization account and aren't associated with a particular project or codebase. In addition, they aren't enforced at build time, including in continuous integration (CI) builds. If you want to associate code style preferences with your project and have the styles enforced during build, specify the preferences in an [.editorconfig file](#code-styles-in-editorconfig-files) that's associated with the project.
91+
Options set in this window are applicable to your Visual Studio personalization account and aren't associated with a particular project or codebase. In addition, they aren't enforced at build time, including in continuous integration (CI) builds. If you want to associate code style preferences with your project and have the styles enforced during build, specify the preferences in an [EditorConfig file](#code-styles-in-editorconfig-files) that's associated with the project.
9292

9393
### Preference and severity
9494

95-
For each code style setting on the **General** and **Naming** options page, you can set the **Preference** and **Severity** values using the drop-downs on each line. Severity can be set to **Refactoring Only**, **Suggestion**, **Warning**, or **Error**.
95+
For each code style setting on the **General** and **Naming** options pages, you can set the **Preference** and **Severity** values using the drop-downs on each line. Severity can be set to **Refactoring Only**, **Suggestion**, **Warning**, or **Error**.
9696

97-
- All code style preferences determine the [Quick Actions](../ide/quick-actions.md) for a code style. The **Quick Actions** light bulb :::image type="icon" source="media/light-bulb-dropdown.png":::, error light bulb :::image type="icon" source="media/error-bulb.png":::, or screwdriver :::image type="icon" source="media/screwdriver.png"::: icon appears when a non-preferred style is used, and you can choose an option on the **Quick Actions** list to automatically rewrite code to the preferred style.
97+
- Code style preferences in the **General** and **Naming** options pages determine the [Quick Actions](../ide/quick-actions.md) for a code style. The **Quick Actions** light bulb :::image type="icon" source="media/light-bulb-dropdown.png":::, error light bulb :::image type="icon" source="media/error-bulb.png":::, or screwdriver :::image type="icon" source="media/screwdriver.png"::: icon appears when a non-preferred style is used, and you can choose an option on the **Quick Actions** list to automatically rewrite code to the preferred style.
9898
- If you want the violation to appear only as a Quick Action and also be excluded from code cleanup, set the **Severity** to **Refactoring Only**.
9999
- If you want the violation to appear in the Error List window as well as Quick Actions, and be included in code cleanup, set the **Severity** to **Suggestion**, **Warning**, or **Error**. Violations appear as a suggestion (message), warning, or error when you set the output in the Error List window to **Build + IntelliSense**. They are excluded from **Build** only output.
100100

101+
Settings in an EditorConfig file take precedence over code styles set in these pages.
102+
101103
## Enforce code styles on build
102104

103105
Starting in Visual Studio 2019 version 16.8, which includes the .NET 5.0 RC2 SDK, you can [enforce the .NET coding conventions on build](/dotnet/fundamentals/productivity/code-analysis#code-style-analysis) for all .NET projects. At build time, .NET code style violations will appear as warnings or errors with an "IDE" prefix. This enables you to strictly enforce consistent code styles in your codebase.
@@ -119,7 +121,7 @@ When you change a code style in the Options page or add an EditorConfig file to
119121

120122
::: moniker range=">=vs-2022"
121123

122-
To apply code styles from an EditorConfig file or from the **Code Style** options page, use the **Code Cleanup** button at the bottom of the editor (keyboard: **Ctrl**+**K**, **Ctrl**+**E**). If an *.editorconfig* file exists for the project, those are the settings that take precedence.
124+
To apply code styles from an EditorConfig file or from the **Code Style** options page, use the **Code Cleanup** button at the bottom of the editor (keyboard: **Ctrl**+**K**, **Ctrl**+**E**). If an EditorConfig file exists for the project, those are the settings that take precedence.
123125

124126
::: zone pivot="programming-language-dotnet,programming-language-dotnetf"
125127
> [!TIP]
@@ -132,6 +134,10 @@ To apply code styles:
132134

133135
![Screenshot of Configure Code Cleanup.](media/vs-2022/configure-code-cleanup.png)
134136

137+
::: zone pivot="programming-language-dotnet,programming-language-dotnetf"
138+
For a mapping of .NET code cleanup fixers to .NET code style rules, see [.NET code cleanup settings](#net-code-cleanup-settings).
139+
::: zone-end
140+
135141
::: zone pivot="programming-language-cpp"
136142
C/C++ options include C++ in the name of the fixer.
137143
::: zone-end
@@ -152,7 +158,7 @@ To apply code styles:
152158

153159
::: moniker range="vs-2019"
154160

155-
For C# code files, Visual Studio has a **Code Cleanup** button at the bottom of the editor (keyboard: **Ctrl**+**K**, **Ctrl**+**E**) to apply code styles from an EditorConfig file or from the **Code Style** options page. If an *.editorconfig* file exists for the project, those are the settings that take precedence.
161+
For C# code files, Visual Studio has a **Code Cleanup** button at the bottom of the editor (keyboard: **Ctrl**+**K**, **Ctrl**+**E**) to apply code styles from an EditorConfig file or from the **Code Style** options page. If an EditorConfig file exists for the project, those are the settings that take precedence.
156162

157163
> [!TIP]
158164
> Rules configured with a severity of **None** don't participate in code cleanup but can be individually applied via the **Quick Actions and Refactorings** menu.
@@ -179,7 +185,7 @@ To apply code styles:
179185
::: zone pivot="programming-language-dotnet,programming-language-dotnetf"
180186
## .NET code cleanup settings
181187

182-
Most of the code cleanup settings map to one or more .NET code styles supported in *.editorconfig*. For examples that show the effects of the settings, use the links in the following table.
188+
Most of the code cleanup settings map to one or more .NET code styles supported in EditorConfig. For examples that show the effects of the settings, use the links in the following table.
183189

184190
|Setting|Rule ID or style option|
185191
|-|-|

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
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: 05/08/2025
45
author: mikejo5000
56
ms.author: mikejo
67
manager: mijacobs
78
ms.subservice: general-ide
89
ms.topic: how-to
910
helpviewer_keywords:
1011
- editorconfig [Visual Studio]
11-
ms.date: 05/08/2025
1212

1313
#customer intent: As a developer, I want to use EditorConfig files to enforce coding style consistency for everyone that writes code in our Visual Studio codebase and projects.
1414

docs/toc.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -960,12 +960,10 @@
960960
href: ide/reference/options-text-editor-all-languages-scroll-bars.md
961961
- name: Tabs
962962
href: ide/reference/options-text-editor-all-languages-tabs.md
963-
- name: Basic
963+
- name: Visual Basic
964964
items:
965965
- name: Advanced
966966
href: ide/reference/options-text-editor-basic-visual-basic.md
967-
- name: Code Style
968-
href: ide/code-styles-and-code-cleanup.md
969967
- name: IntelliSense
970968
href: ide/visual-basic-specific-intellisense.md
971969
- name: C#

0 commit comments

Comments
 (0)