Skip to content

Commit 16ff3b6

Browse files
TylerMSFTTylerMSFT
authored andcommitted
edit pass
1 parent bfb2d75 commit 16ff3b6

File tree

4 files changed

+52
-59
lines changed

4 files changed

+52
-59
lines changed

docs/ide/include-cleanup-config.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
---
2-
title: "Configure C/C++ include cleanup in Visual Studio"
3-
description: "Learn how to configure C/C++ include cleanup."
2+
title: "Configure C/C++ Include Cleanup in Visual Studio"
3+
description: "Learn how to configure C/C++ Include Cleanup."
44
ms.date: 10/10/2023
55
ms.topic: "how-to"
66
f1_keywords: ["config include cleanup"]
77
helpviewer_keywords: ["config include cleanup"]
88
---
9-
# Configure C/C++ include cleanup in Visual Studio
9+
# Configure C/C++ Include Cleanup in Visual Studio
1010

1111
Starting with 17.8 Preview 1, Visual Studio can clean up your `#include`s to improve the quality of your C and C++ code in the following ways:
12-
- Offers to add header files for code that is only working because the needed header file is included indirectly.
12+
- Offers to add header files for code that compiles only because a needed header file is included indirectly by another header file.
1313
- Offers to remove unused header files--improving build times.
1414

15-
This article describes how to configure include cleanup in Visual Studio. For more information about include cleanup, see [C/C++ include cleanup overview](include-cleanup-overview.md).
15+
This article describes how to configure Include Cleanup in Visual Studio. For more information about Include Cleanup, see [C/C++ Include Cleanup overview](include-cleanup-overview.md).
1616

17-
## Turn on include cleanup
17+
## Turn on Include Cleanup
1818

19-
The include cleanup feature is on by default. If it isn't active, you can turn it on via **Tools** > **Options** > **Text Editor** > **C/C++** > **Code Cleanup** and select **Enable #include cleanup**.
19+
The Include Cleanup feature is on by default. If it isn't active, you can turn it on via **Tools** > **Options** > **Text Editor** > **C/C++** > **Code Cleanup** and select **Enable #include cleanup**.
2020

2121
Then use the dropdowns to configure how you want to be notified about opportunities to add indirect headers or remove unused headers:
2222

@@ -26,42 +26,42 @@ The Enable # include cleanup checkbox is checked. The dropdowns for Remove unuse
2626

2727
The meanings of the suggestion level options are:
2828

29-
**Refactoring only**: Include cleanup offers actions you can take through the quick action menu when you hover the mouse pointer over an `#include`, or place the cursor on the `#include` line and press Ctrl+period:
29+
**Refactoring only**: Include Cleanup offers actions you can take through the quick action menu when you hover the mouse pointer over an `#include`, or place the cursor on the `#include` line and press Ctrl+period:
3030

3131
:::image type="complex" source="media/include-cleanup-refactor-lightbulb.png" alt-text="A screenshot of the quick action to remove an unused header":::
3232
When hovering the cursor over # include iostream, a light bulb appears with the text that # include iostream isn't used in this file."
3333
:::image-end:::
3434

35-
**Suggestion, Warning, Error**: Include cleanup offers actions it can take via suggestions, warnings, or errors in the Error List window. You determine which. In the following screenshot of the Error List, include cleanup is configured to show unused headers with a warning. Ensure that **Build + Intellisense** is selected in the dropdown filter so that you can see the include cleanup output:
35+
**Suggestion, Warning, Error**: Include Cleanup offers actions it can take via suggestions, warnings, or errors in the Error List window. You determine which. In the following screenshot of the Error List, Include Cleanup is configured to show unused headers with a warning. Ensure that **Build + Intellisense** is selected in the dropdown filter so that you can see the Include Cleanup output:
3636

3737
:::image type="complex" source="media/include-cleanup-error-list.png" alt-text="A screenshot of the Error List window.":::
3838
The dropdown filter is set to Build + IntelliSense. A warning is visible: VCIC002 - #include < iostream > isn't used in this file."
3939
:::image-end:::
4040

4141
**Dimmed**
4242

43-
Include cleanup shows unused headers by dimming the line of the unused header file in the code editor. Hover your cursor over the dimmed `#include` to bring up the quick action menu and choose **Show potential fixes** to see actions related to the unused file.
43+
Include Cleanup shows unused headers by dimming the line of the unused header file in the code editor. Hover your cursor over the dimmed `#include` to bring up the quick action menu and choose **Show potential fixes**, or click on the lightbulb dropdown, to see actions related to the unused file.
4444

4545
:::image type="complex" source="media/include-cleanup-dimmed-include.png" alt-text="A screenshot of a dimmed #include < iostream > line.":::
4646
The line for #include < iostream > is dimmed because the line of code that uses iostream is commented out. That line of code is // std::cout << "charSize = " << charSize; The quick action menu is also visible for this line. It says the #include < iostream > isn't used in this file, and has a link to Show potential fixes.
4747
:::image-end:::
4848

49-
## Configure include cleanup with `.editorconfig`
49+
## Configure Include Cleanup with `.editorconfig`
5050

51-
There are more options for configuring include cleanup such as excluding specified includes from cleanup suggestions, indicating that some header files are required so that the tool doesn't mark them as unused, and so on. These options are defined in an `.editorconfig` file, that, among other things, can be added to your project to enforce consistent coding styles for everyone that works in the codebase. For more information about adding an `.editorconfig` file to your project, see [Create portable, custom editor settings with EditorConfig](/visualstudio/ide/create-portable-custom-editor-options).
51+
There are more options for configuring Include Cleanup such as excluding specified includes from cleanup suggestions, indicating that some header files are required so that the tool doesn't mark them as unused, and so on. These options are defined in an `.editorconfig` file, that you can add to your project to, among other things, enforce consistent coding styles for everyone that works in the codebase. For more information about adding an `.editorconfig` file to your project, see [Create portable, custom editor settings with EditorConfig](/visualstudio/ide/create-portable-custom-editor-options).
5252

53-
The `.editorconfig` settings that you can use with include cleanup are:
53+
The `.editorconfig` settings that you can use with Include Cleanup are:
5454

5555
| Setting | Description | Values | Example |
5656
|--|--|--|--|
57-
| `cpp_include_cleanup_add_missing_error_tag_type` | Sets the error level of add transitive include suggestions. | `none`</br>`suggestion`</br>`warning`</br>`error` | `cpp_include_cleanup_add_missing_error_tag_type = suggestion` |
58-
| `cpp_include_cleanup_remove_unused_error_tag_type` | Sets the error level of remove unused include suggestions. | `none`</br>`suggestion`</br>`warning`</br>`error`</br>`dimmed` | `cpp_include_cleanup_remove_unused_error_tag_type = dimmed` |
59-
| `cpp_include_cleanup_excluded_files` | Excludes the specified files from include tool cleanup suggestions. You won’t get a suggestion related to the header at all, whether to add it or that it's unused. | filename | `cpp_include_cleanup_excluded_files = vcruntime.h, vcruntime_string.h` |
60-
| `cpp_include_cleanup_required_files` | Specify that usage of file1 requires file2. For example, specify that if you use `atlwin.h` that `altbase.h` must also be included. | file1:file2 | `cpp_include_cleanup_required_files = atlwin.h:altbase.h, atlcom.h:altbase.h` |
61-
| `cpp_include_cleanup_replacement_files` | Suggest that the usage of file1 be replaced by file2. | file1:file2 | `cpp_include_cleanup_replacement_files = stdio.h:cstdio,stdint.h:cstdint` |
62-
| `cpp_include_cleanup_alternate_files` | Suggest that file1 be used as an alternative to file2. Useful for facade files. | file1:file2 | `cpp_include_cleanup_alternate_files = windows.h:minwindef.h, windows.h:winerror.h` |
57+
| `cpp_include_cleanup_add_missing_error_tag_type` | Sets the error level of add transitive include messages. | `none`</br>`suggestion`</br>`warning`</br>`error` | `cpp_include_cleanup_add_missing_error_tag_type = suggestion` |
58+
| `cpp_include_cleanup_remove_unused_error_tag_type` | Sets the error level of remove unused include messages. | `none`</br>`suggestion`</br>`warning`</br>`error`</br>`dimmed` | `cpp_include_cleanup_remove_unused_error_tag_type = dimmed` |
59+
| `cpp_include_cleanup_excluded_files` | Excludes the specified files from Include Cleanup messages. You won’t get a suggestion related to the header at all, whether to add it or that it's unused. | filename | `cpp_include_cleanup_excluded_files = vcruntime.h, vcruntime_string.h` |
60+
| `cpp_include_cleanup_required_files` | Specify that usage of *file1* requires *file2*. For example, specify that if you use `atlwin.h` that `altbase.h` must also be included. | file1:file2 | `cpp_include_cleanup_required_files = atlwin.h:altbase.h, atlcom.h:altbase.h` |
61+
| `cpp_include_cleanup_replacement_files` | Suggest replacing *file1* with *file2*. | *file1*:*file2* | `cpp_include_cleanup_replacement_files = stdio.h:cstdio,stdint.h:cstdint` |
62+
| `cpp_include_cleanup_alternate_files` | Suggest using *file1* as an alternative to *file2*. Useful for facade files. | *file1*:*file2* | `cpp_include_cleanup_alternate_files = windows.h:minwindef.h, windows.h:winerror.h` |
6363

6464
## See also
6565

66-
[C/C++ include cleanup overview](include-cleanup-overview.md)\
67-
[Include cleanup messages](include-cleanup-messages.md)
66+
[C/C++ Include Cleanup overview](include-cleanup-overview.md)\
67+
[Include Cleanup messages](include-cleanup-messages.md)

docs/ide/include-cleanup-messages.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
---
2-
title: "Include cleanup messages"
2+
title: "Include Cleanup messages"
33
description: "Learn what the messages generated by Include Cleanup mean."
44
ms.date: 10/10/2023
55
ms.topic: "reference"
66
f1_keywords: ["VCIC001", "VCIC002"]
77
helpviewer_keywords: ["VCIC001", "VCIC002"]
88
---
9-
# Include cleanup messages
9+
# Include Cleanup messages
1010

11-
This article describes the messages generated by the include cleanup feature. For more information about include cleanup, see [C/C++ include cleanup overview](include-cleanup-overview.md).
11+
This article describes the messages generated by the Include Cleanup feature. For more information about Include Cleanup, see [C/C++ Include Cleanup overview](include-cleanup-overview.md).
1212

1313
Starting with 17.8 Preview 1, Visual Studio can clean up your `#include`s to improve the quality of your C and C++ code in the following ways:
1414

15-
- Offers to add header files for code that is only working because the needed header file is included indirectly.
15+
- Offers to add header files for code that compiles only because a needed header file is included indirectly by another header file.
1616
- Offers to remove unused header files--improving build times.
1717

18-
You can choose whether messages from Include cleanup appear in the form of suggestions, warnings, or errors in the Error List window. For more information, see [Config C/C++ include cleanup in Visual Studio](include-cleanup-config.md).
18+
You can choose whether messages from Include Cleanup appear in the form of suggestions, warnings, or errors in the Error List window. For more information, see [Config C/C++ Include Cleanup in Visual Studio](include-cleanup-config.md).
1919

20-
In the following screenshot of the Error List, include cleanup is configured to show unused headers with a warning:
20+
In the following screenshot of the Error List, Include Cleanup is configured to show unused headers with a warning:
2121

2222
:::image type="complex" source="media/include-cleanup-error-list.png" alt-text="A screenshot of the Error List window.":::
2323
The dropdown filter is set to Build + IntelliSense. A warning is visible: VCIC002 - #include < iostream > isn't used in this file."
2424
:::image-end:::
2525

26-
Include cleanup generates the following messages:
26+
Include Cleanup generates the following messages:
2727

2828
## `VCIC001`: Content from #include is used in this file and transitively included
2929

@@ -37,5 +37,5 @@ This message means that the specified header file is not used in the current fil
3737

3838
## See also
3939

40-
[C/C++ include cleanup overview](include-cleanup-overview.md)\
41-
[Config C/C++ include cleanup in Visual Studio](include-cleanup-config.md)
40+
[C/C++ Include Cleanup overview](include-cleanup-overview.md)\
41+
[Configure C/C++ Include Cleanup in Visual Studio](include-cleanup-config.md)

0 commit comments

Comments
 (0)