READMEClang-Format is a tool to format many different coding languages. It can be configured with a config file named This project is a fork of the older vscode-clang-format extension, but has been rewritten with modern VSIX and TypeScript best practices. I believe that I have integrated all outstanding feature requests as well. UsageThis extension allows clang-format to be used to format C/C++, Javascript etc. source files directly from within Visual Studio Code 1.96+. 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:
Specifying the location of clang-formatThis extension will attempt to find clang-format on your
Placeholders can also be used in the
Some examples:
Placeholders are also supported in For example:
The same placeholders are also supported for Installing Clang-FormatOn Linux, install On MacOS, the simplest way is to use Homebrew and run On Windows, the simplest way is to install LLVM to the default path either using the installer or by simply running LLVM contains the clang-format binary, the resulting path for the
Source codeAvailable on github: https://github.com/a5ehren/vscode-clang-format Update PolicyI consider this extension to be fully feature complete. Releases will be made roughly quarterly if the GitHub dependabot finds changes to be made or there are non-critical issues I can resolve. Security fixes will be released as-needed as quickly as possible. |