My current set of changes in a git-tracked Arduino project have just been smothered under a whole bunch of IDE 2.0 auto-formatting.
With the 1.x IDE, I kept "use an external editor" turned on. This had the salutary affect of making sure the IDE never tried to auto-format or otherwise edit my source code.
With IDE 2.0, apparently that feature is missing & the IDE has apparently been set free to covert tabs to spaces all over my entire source tree. I have no idea how I'll clean up this mess.
Auto-formatting is a nice optional feature, but I need to be able to turn it off before I'll let 2.0 near my git repo again.
The user must manually trigger an "Auto Format" operation by one of the following:
Selecting it from the Arduino IDE menus (e.g., Edit > Auto Format)
Pressing the keyboard shortcut (e.g., Ctrl+T)
So it seems to me that you should simply not trigger an auto format if you don't want auto format. Am I missing something?
If you find the keyboard shortcut is something you press inadvertently, you can change it to something more complex (e.g., Ctrl+Alt+Shift+T) via File > Advanced > Keyboard Shortcuts.
Aha! Actually it appears that on a Mac this is mapped to Cmd-T, not Ctrl-T.
Cmd-T is the standard way to create a new tab in Mac apps that have tabbed interfaces, so it's quite possible that I hit that, saw that I didn't get a new tab, but did not see that my white space had been reformatted. Ctrl-T would be a better default mapping for this, on a Mac.
Apple publishes a list of standard OS shortcuts which app developers should avoid redefining:
In general, MacOS apps should not try to assign other meanings to any of these key combos.
I think Ctrl-T would be a better mapping on the Mac, actually. All Macs have Ctrl keys & Apple avoids using it for shortcuts. (Although that doc does show a set of Control-* mappings for text editing, including Ctrl-T, but in my experience those are way less "standard" and a lot of apps redefine them.)
So yeah, I predict your Mac users are fairly likely to hit Ctrl-T at some point expecting completely different behavior. And since the auto-format might not make any visible changes on the section of the doc that's in the editor window, they will have silently edited their documents, which likely is not what they want.
I will go ahead and redefine auto-format that to Ctrl-T for now. I suggest that would be a better default in general. Also, it would still be useful to have a "read only" option in the IDE.
But it's nice to know that the Auto-Format feature is not actually Auto. Sorry for presuming otherwise.
Even though some changes were made, Arduino IDE 1.x was used as a model for the design of Arduino IDE 2.x. I know the Ctrl+T shortcut for Auto Format came from Arduino IDE 1.x and am sure Cmd+T had the same origin (I don't have access to a macOS machine to check it). Migrating users would likely be quite upset if this commonly used keyboard shortcut had been changed.
At least we are fortunate that one of the advancements made in Arduino IDE 2.x was the addition of a keyboard shortcut customization capability (they were not customizable in Arduino IDE 1.x) so each of us can set the shortcuts to our own preference.
If you use VS Code, you might be interested to know that its standard Alt+Shift+F keyboard shortcut also triggers an Auto Format.
Indeed I’m quite used to cmdT and it’s ctrlF as well in wokwi. I always open a new tab in Safari on My Mac when I try to indent the code in wokwi… muscle memory