Auto Format Not Working(Most of the Time) #548
Labels
conclusion: duplicate
Has already been submitted
topic: code
Related to content of the project itself
topic: language server
Related to the Arduino Language Server
type: imperfection
Perceived defect in any part of project
Auto Format does not work and when it does work, it does so under some weird conditions. I tried both with the shortcut and menu tool and both don't work or at least not properly. Anytime when I am coding 99% of the time I could never get it to work. The only time I got it to work "somewhat" reliably was when I opened a blank sketch and even then under very specific circumstances. (btw, I tested this with 2.0.0-beta.12 using .exe .msi and .zip on both Win 10 and Win 7, Exact same effect on all, I have yet to try on Mac)
The only way I got Auto format to work is if you have a blank sketch with only the void setup and loop. If you put a space in front of void loop() like this:




If you hit CTRL + t or click the button from the menu (after it finishes building the sketch of course) you will see it will format and shift the void loop back where it belongs and it will do so quite reliably every single time I found:
However, if you try to do this with the setup() like this:
It will not work no matter how much you try, even if you try to do this to both(loop and setup) It just simply stops working at this point:
This is by far the weirdest behavior I found with the Auto Format tool. All the other times Auto Format would simply not work at all.
Anyway, I just wanted to bring this to attention and thought this might be some useful clue that might help out in figuring out what is really going on
I actually got the auto format to somehow randomly delete some line of code while doing the test but so far I did not find a way to replicate this.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: