Skip to content

Optimizing your configuration

Bob Brown edited this page Aug 29, 2025 · 2 revisions

Default behavior

When you open a folder in a workspace for the first time, the C/C++ extension will automatically begin looking through all of the files and parsing through C and C++ source files and headers. This is usually the behavior you want since the language services are more useful when they know about the data structures, functions, and other code items in your workspace.

In some cases, however, the workspace folder may also contain lots of non-code files that are irrelevant to language services. When this is the case, there are a few settings you can use to trim down the number of files that the extension has to look at and save CPU work.

Settings that reduce the amount of work VS Code and extensions do

files.exclude

This setting tells VS Code to completely ignore the set of folders you specify. Folders excluded with this setting will not appear in the Explorer view, participate in search, or provide any information to the language server. The language server will not be notified of changes to these files. Source control and build system folders/files are good candidates for this setting.

search.exclude

This setting tells VS Code not to process the folders specified. Folders excluded with this setting will continue to appear in the Explorer view, but the files in those folders will not be considered while doing text searches or code symbol searches. Folders that do not contain code files are good candidates for this setting.

C_Cpp.files.exclude

This setting tells the C++ extension not to process the folders specified. Folders excluded with this setting will not have their contents scanned and added to the C++ extension's database of code symbols. If you work in a large codebase, but only use a small portion of it for your development, this setting can reduce the amount of work the extension needs to do.

Other things to consider

  • Don't open your file system's root folder.
  • Beware of symlinks that link to folders outside of the workspace.
  • For large projects, consider opening only the folders you need in a multi-root workspace.
  • You can also narrow down the number of folders to include using the includePath and browse.path properties in your c_cpp_properties.json configuration file.

Debugger

Troubleshooting

Clone this wiki locally