Hi, I noticed that the current version (2.xx) enforces a specific (K&R) style curly bracket, and does not seem to allow any freedom anymore. ...at least without resorting to tricks.
Allman style is visually clearer, for me at least, so it would be awesome if someone could say how to fix that.
The tutorial does link to the file containing the official Arduino code style. So you have the option of downloading that file and making any specific adjustments you like instead of starting from a blank page.
But sterretje provided a link to a modified version of that file that already has the BreakBeforeBraces: Allman modification (and maybe some other things too?).
Thanks for bringing up this issue and for @sterretje sharing his format file.
I first tried the .clang-format in my sketch folder and tested the Allman and Attach options.
Then I deleted it and moved it to my ~/arduinoIDE folder, I install the nightly via zip, and it took those settings system wide. Linux/Kubuntu 20.04.5
Along the same lines, is there a way to PREVENT auto-format from changing a particular block of lines?
eg to leave this "as is" (without the line break)
if (someCondition) {// do stuff if the condition is true} else {// do stuff if the condition is false}
rather than
if (someCondition) {
// do stuff if the condition is true
}
else {
// do stuff if the condition is false
}
make the code spread complex functions across multiple pages with not much text - so it looks like this, wastes paper and makes the code hard to follow.
Thank you @ptillisch and @sterretje !! This is wonderful news, the solution (and ready-modified .clang-format) seem to work quite well.
Funny how such a small thing such as curly brackets and their placement can influence the ability to think and write code, bringing it to a stop if not "correct".