Skip to content

Commit 9c66e48

Browse files
TylerMSFTTylerMSFT
authored andcommitted
edits
1 parent ed45b14 commit 9c66e48

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

docs/ide/include-cleanup-config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The dropdown filter is set to Build + IntelliSense. A warning is visible: VCIC00
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**, or click on the lightbulb dropdown, 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 light bulb 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.

docs/ide/include-cleanup-overview.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Include Cleanup is on by default. To learn how to configure it, see [Config C/C+
2121
First some terminology:
2222

2323
- A direct header is a header that you explicitly `#include` in your code.
24-
- An indirect header is a header that you don't explicitly `#include`, but that is included by a header file that you do directly include. We also say that an indirect header is included `transitively`.
24+
- An indirect header is a header that you don't explicitly `#include`. Instead, a header file that you do directly include, includes it. We also say that an indirect header is included `transitively`.
2525

2626
Include Cleanup analyzes your code and determines which headers aren't used and which are indirectly included. Consider the following header file:
2727

@@ -105,16 +105,16 @@ The tool doesn't update the comments, but you can see that the code is now using
105105

106106
## Best practice
107107

108-
Don't remove what appear to be unused header files without first adding indirectly included header files. That's because your code may rely on indirect includes in a header file that is otherwise unused. Add transitively used headers first. Then, when you remove unused headers, you won't have compilation errors due to missing header files that were included indirectly by a header file you've removed.
108+
Don't remove what appear to be unused header files without first adding indirectly included header files. That's because your code may rely on indirect includes in a header file that is otherwise unused. Add transitively used headers first. Then, when you remove unused headers, you don't get compilation errors due to missing header files that are included indirectly by a header file you've removed.
109109

110-
One way to do this is to set the Include Cleanup setting for **Add missing includes suggestion level** to **Suggestion** (**Tools** > **Options** > **Text Editor** > **C/C++** > **Code Cleanup**). Also set **Remove unused includes suggestion level** to **Suggestion**. Then:
110+
One way to do this is to set the Include Cleanup setting for **Add missing includes suggestion level** to **Suggestion** (**Tools** > **Options** > **Text Editor** > **C/C++** > **Code Cleanup**). Also set **Remove unused includes suggestion level** to **Suggestion**. Then:
111111

112112
1. In the error list, make sure the filter is set to **Build + IntelliSense**.
113113
1. Look for instances of "Content from #include x is used in this file and transitively included."
114-
1. Hover your cursor over a line with the suggestion. From the lightbulb dropdown, select **Add all transitively used includes**.
114+
1. Hover your cursor over a line with the suggestion. From the light bulb dropdown, select **Add all transitively used includes**.
115115
1. Repeat these steps in your project until all suggestions regarding transitive includes are addressed.
116116
1. Remove unused includes: in the error list, look for an instance of "#include x is not used in this file."
117-
1. Hover your cursor over the unused header. From the lightbulb dropdown, select **Remove all unused includes**.
117+
1. Hover your cursor over the unused header. From the light bulb dropdown, select **Remove all unused includes**.
118118
1. Repeat these steps in your project until all Include Cleanup suggestions are addressed.
119119

120120
In this brief overview, you've seen how Include Cleanup can help you remove unused headers, and add headers that were indirectly included. This helps you keep your code clean, potentially build faster, and reduces the brittleness of your code.

0 commit comments

Comments
 (0)