While minor variations exist, virtually all Java code follows these conventions pretty closely.
Although I'll note it seems to get a bit more chaotic with regards to indenting newer constructions like streams and lambdas.
> Let some whitespace be programmable. The layout of the input influences the layout choices in the output. This means that the choices between single-line/multi-line layouts in certain situations are made by the user, not by an algorithm. This makes the implementation simpler and leaves some control to the user while still guaranteeing that the formatted code is stylistically consistent.
Coq, Agda, etc. also don't have formatters either, partly because "user-defined layout", but also partly because their syntax is just so complicated and they have smaller ecosystems
function(
arg,
arg
);
New line per argument, closing parenthesis on a new line. This is standard in most langauges, yet clang-format cannot handle it.Then it also insists on aligning everything prettily. Most, but not all of it can be disabled though.
And lastly it doesn't do very well with tab indents. Most of it works perfectly, you just need to set both tab size and indent size, but then it decides to do its alignment thing and suddenly that line is all spaces, even the base indent.
Clang-format is honestly by far the worst formatter I've had the displeasure to fight. C/C++ still needs to be formatted manually
Oooh, that's much closer. Not perfect, but so much better. Do you have a solution for this as well?
→(StructType){
→····.a = 1,
→····.b = 2,
→};
It's not just this scenario, but this is the worst one. It does it regardless of useTab and what's worse is that it's four spaces when both indent width and tab size are set to 8I haven't myself worked on a tabbed code base during clang-format's existence. You might want to look at Linux's settings for ideas, although they clearly differ from your preferences in other ways. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...