

If you want to navigate to the location of one of the definitions just double-click the definition you're interested in, or by double-clicking anywhere in the source code displayed on the left-hand side of the peek window. With the peek window open, you browse the list of competing definitions to find the one you're interested in. When this happens, each of the competing definitions is listed in the right-hand side of the peek window with the source code of the current selection displayed on the left. These competing definitions arise when the symbol defines different things in different contexts, such as occurs with overloaded functions, classes and their constructors, and other situations. Alternatively, you can choose Peek Definition from the context menu (right-click, then choose Peek Definition).Ĭurrently, the C/C++ extension doesn't parse code in a way that helps it distinguish between competing definitions based on how the symbol is used. To peek at a symbol's definition, place your cursor on the symbol anywhere it's used in your source code and then press ⌥F12 (Windows Alt+F12, Linux Ctrl+Shift+F10).

The Peek Definition feature displays a few lines of code near the definition inside a peek window, so that you don't have to navigate away from your current location. You can hover over a symbol to see an inline view of its definition: See Enhanced colorization for more details about setting colors for classes, functions, variables and so on. When IntelliSense is enabled, the Visual Studio Code C/C++ extension supports semantic colorization.
Visual studio code formatting settings windows#
To use a different version of clang-format than the one that ships with the extension, change the C_Cpp.clang_format_path setting to the path where the clang-format binary is installed.įor example, on the Windows platform: "C_Cpp.clang_format_path" : "C: \\ Program Files (x86) \\ LLVM \\ bin \\ clang-format.exe" Enhanced semantic colorization The Visual Studio clang-format style is not yet an official clang-format style but it implies the following clang-format settings: UseTab: (VS Code current setting) IndentWidth: (VS Code current setting) BreakBeforeBraces: Allman AllowShortIfStatementsOnASingleLine: false IndentCaseLabels: false ColumnLimit: 0 Currently, the default formatting style is "Visual Studio" which is an approximation of the default code formatter in Visual Studio. clang-format file is found in your workspace, formatting is applied based on a default style specified in the C_Cpp.clang_format_fallbackStyle setting instead. clang-format file is found, formatting is applied according to the settings specified in the file.

If a referenced header file can't be found, VS Code displays a green squiggle underneath each #include directive that references it. By default, the extension searches the current source directory, its sub-directories, and some platform-specific locations.

To provide the best experience, the extension needs to know where it can find each header file referenced in your code. The C/C++ extension for VS Code has many features that help you write code, understand it, and navigate around in your source files. The C/C++ extension supports Remote Development. For more information about editing in Visual Studio Code, see Basic Editing and Code Navigation. This topic provides a quick overview of general C/C++ editor features, as well as some that are specific to C/C++. Configure IntelliSense for cross-compiling.
