Home

ClangFormat your JAVA CODE?

Written on 2021-12-06

Quick PSA!

If you've ever used ClangFormat before, chances are that you wanted it to format C++ or C code. Well, it turns out that it has a Language configuration option that you can use to specify that you want to format another language (shocker, I know).

ClangFormat currently supports C/C++, C#, Java, JavaScript, JSON, Objective-C, Protocol Buffers and TableGen (some internal LLVM stuff). Those languages already have their own formatters but it's quite nice to be able to just use ClangFormat, especially in environments where it's already in use (also it's just a static binary and I like that).