Change IDE 2.3 auto-format option?

I started using IDE 2.3 but I noticed the auto format does something I'd like to change if possible. Curly braces are formatted to have the beginning or top brace right at the end of the line of code it is related to. I would like to have the curly brace on the next line down left justified to it's corresponding indentation lining up with the closing brace so that it is easier to see the blocks of code. Is it possible to change the auto format behavior so that it does this, because right now it "fixes" all of my code from the way I like it to the aforementioned placement.

1 Like

Hi @perigalacticon. You can learn how to customize the behavior of the Arduino IDE 2.x Auto Format feature from this tutorial:

https://docs.arduino.cc/software/ide-v2/tutorials/ide-v2-customize-auto-formatter

1 Like

This post (Clang setup; where is .clang-format - #10 by sterretje) has a zipped .clangformat file attached; it has the setting that you want.

You can test your configuration with http://clang-format-configurator.site/; I haven't played much with it.

Hi @sterretje. I think the attachment went missing from your post.

FYI, the link at the bottom of that page is dead - for me.

image

https://docs.arduino.cc/software/ide-v2/

Thanks, fixed

I wanted to link the post so @perigalacticon can follow the discussion.

Thanks for bringing this to our attention @dougp! I have submitted a fix for the broken link:

1 Like

shows setting for the .clang-format file that will change auto format spaces
IndentWidth: 8

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.