Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>VSCode UncrustifyNew to Visual Studio Code? Get it now.
VSCode Uncrustify

VSCode Uncrustify

MSA Safety

|
8 installs
| (0) | Free
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

vscode-uncrustify

vscode-uncrustify is a formatter which uses Uncrustify to format C, C++, and some other languages with C-like syntax.

Features

  • Exclude paths from formatting
  • Specify default .cfg file
  • Specify Uncrustify executable to use
  • Use different .cfg files for different file extensions
  • On-save formatting
  • Formatting support for C, C++, Objective-C, C#, D, Java, Vala, and Pawn

Requirements

  • An Uncrustify binary. Uncrustify is available through many package managers and as a prebuilt Windows binary. More information here.

Usage

Formatting

  • Files can be formatted through the built-in Format Document command in the Command Palette.
  • vscode-uncrustify can be set as your default formatter in Settings (Ctrl + ,).
  • On-save formatting can be turned on in Settings (Ctrl + ,).

Commands

  • Open Log: Open the log for the most recent vscode-uncrustify run. Will fail if vscode-uncrustify has not yet run.

Settings

  • uncrustify.defaultConfigFile: Path to default Uncrustify .cfg file. If empty, uncrustify will try to find a config file in your $PATH.
  • uncrustify.executablePath.<linux|windows|OSX>: Uncrustify executable path for the given operating system.
  • uncrustify.excludePaths: Directory paths for which to disable formatting.
  • uncrustify.enableLogs: Logs uncrustify commands and results to an output pane.
  • uncrustify.advanced.extension-SpecificConfigFiles: Object containing key-value pairs of file extensions and paths to cfg files. If null (default), default cfg file will be used for all file extensions. Takes precedence over uncrustify.defaultConfigFile setting.
  • uncrustify.advanced.extension-SpecificLangOverrides: Extension to overridden Uncrustify parse language.

NOTE: The string ${workspaceFolder} can be used as shorthand for the workspace root directory in these settings.

Extension-Specific Config Files Setting

  • Should be written in JSON format mapping file extension strings to .cfg filepath strings. For example:
"uncrustify.advanced.extension-SpecificConfigFiles": {
  ".c": "/home/user/code/config/src-config.cfg",
  ".h": "/home/user/code/config/inc-config.cfg",
  ".cpp": "${workspaceFolder}/uncrustify/cpp-config.cfg"
}

Extension-Specific Language Overrides

Uncrustify will often treat .h files as C++ when parsing. This extension sets .h files to always parse as C by default:

"uncrustify.advanced.extension-SpecificLangOverrides": {
  ".h": "C"
}

To disable this behavior, set the .h extension to an empty string "".

Acknowledgements

Authors:

  • Aster Mayhew
  • Jonathan Povirk

Icon by Sylwia Bartyzel from Noun Project (CC BY 3.0)

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