Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Clang FormatNew to Visual Studio Code? Get it now.
Clang Format

Clang Format

clang-format

|
9,374 installs
| (1) | Free
Use Clang-Format in Visual Studio Code
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

README

Clang-Format is a tool to format C/C++/Java/JavaScript/Objective-C/Objective-C++/Protobuf code. It can be configured with a config file within the working folder or a parent folder. Configuration see: http://clang.llvm.org/docs/ClangFormatStyleOptions.html

Usage

This extension allows clang-format (version 3.8 or higher) to be used to format C/C++, Javascript etc. source files directly from within Visual Studio Code.

Files can be formatted on-demand by right clicking in the document and selecting "Format Document", or by using the associated keyboard shortcut (usually Ctrl+⇧+F on Windows, Ctrl+⇧+I on Linux, and ⇧+⌥+F on macOS).

To automatically format a file on save, add the following to your vscode settings.json file:

{
    "editor.formatOnSave": true
}

Specifying the location of clang-format

This extension will attempt to find clang-format on your PATH. Alternatively, the clang-format executable can be specified in your vscode settings.json file:

{
    "clang-format.executable": "/absolute/path/to/clang-format"
}

Source code

Available on github: https://github.com/xaverh/vscode-clang-format-provider

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft