Monday, January 13, 2014

Highly configurable source code formatting / indentation for Visual Studio

The latest release of Clang incorporates a new tool: clang-format. clang-format is a highly configurable source code formatting tool for C, C++ and Objective-C code.

clang-format is available as a plugin for Visual Studio 2010 and later from the bottom of this page. Just download and install, mark the source code to be formatted (Ctrl-A) and either select TOOLS|ClangFormat from the menu or simply press Ctrl-R Ctrl-F. This formats the selected code using the standard configuration. It also inserts and removes line breaks as seen fit.

There are multiple options how to give a different configuration to clang-format. Select TOOLS|Options from the menu and have a look:

Comment if you like this or have a better tool at hand!

No comments:

Post a Comment