UPDATE: SOLUTION courtesy of @sterretjeBreakBeforeBraces: Whitesmiths
Hey everyone,
I found out how to make the Arduino IDE's auto-format to put a linebreak before open braces, but I couldn't find how to indent those braces.
With the clang-format file I found online, I currently get:
if (foo == bar)
{
ampCh = 1;
switchToAmpCh(0);
}
What I would like is:
if (foo == bar)
{
ampCh = 1;
switchToAmpCh(0);
}
I played around with the clang-format configurator website, but couldn't manage to get it how I wanted.
Anyone know the secret sauce for this?
Hey gang,
I want to adjust the formatting of {}, specifically the indenting of them. I was able to make some progress, but cannot, for the life of my, make it format like this:
if (something)
{
doStuff;
}
I have tried doing it myself, I have tried an online tool, I have tried asking AI tools to write it for me, but have had no luck.
The best I have managed is:
if (something)
{
doStuff;
}
I had to add .txt extension to allow uploading to the forum. .clang-format.txt (4.2 KB)
Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.
Repeated cross-posting can result in a suspension from the forum.
In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.
Thanks for combining them @pert, it won't happen again.
I had actually forgotten I had made that post as there was no resolution or reply from admin about it.
I understand you like another formatting.
For many many other programers (that use the normal formatting) your format is pretty confusing.
In the end it will be easier for you (and us) if you adhere to the standard ways of doing this...
Thanks you @sterretje, that's perfect! Exactly what I have been looking for.
I'll update my original post with the solution. I believe I wasn't the only one looking for such an option.