-
-
Notifications
You must be signed in to change notification settings - Fork 436
Autoformat tab size does not change #1133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @tsumanuma. Thanks for your report. As a workaround, I can share the work in progress documentation for customizing the Auto Format configuration according to your preferences: ❗ There is currently an error in that document (which will be corrected before it is published on arduino.cc): The file name ( If you would like to change the indent size to 4, copy the configuration provided in the documentation, but change this line: IndentWidth: 2 to this: IndentWidth: 4 In order to make relevant information available to all interested parties, I'll link to the previous report for Arduino IDE 1.x: arduino/Arduino#5012 |
It worked! |
You are welcome. I'm glad the workaround was helpful. However, I think that we should eventually make the Arduino IDE 2.x work correctly without the need for such a workaround. So I hope you won't mind that I am reopening this issue so that we can effectively track that task. I have learned more about the IDE's auto formatter and about the ClangFormat tool recently and I now understand several important things: The IDE adjusts the formatter configurationUnlike the Arduino IDE 1.x, where the formatter configuration is completely independent from the editor configuration, Arduino IDE 2.x has a sophisticated system for adjusting the formatter configuration according to the user's advanced settings for the editor:
The code is here: ClangFormat has a complex way of using tabsDuring the formatting process, ClangFormat does the initial indentation using spaces, according to the If use of tabs for the final indents is indicated by the This means there is a complex interaction between the The IDE does not correctly adjust the formatter configurationDue to the way ClangFormat uses tabs, the expected output will only be produced when the Currently, the IDE adjusts only the So if you have the following IDE configuration: {
"editor.insertSpaces": false,
"editor.tabSize": 4
} The editor will produce the expected results: but the IDE's "Auto Format" will produce something very odd: (the → are tabs and the • are spaces) |
Describe the problem
Sorry if I'm rude as this is the first time I've used this.
I would like to change the tab size from 2 to 4
I was able to change the width when typing with the keyboard, but not when auto-formatting.
Please, and thank you
To reproduce
In the Command Palette (Ctrl+Shift+P), select "Preferences". Selected "Open Preferences".
I then selected "Editor"; in the Advanced Settings GUI I selected "Tab Size" and changed it.
Expected behavior
When I press Control + T, the tab is formatted with two sizes
Arduino IDE version
2.0.0-rc8
Operating system
Windows
Operating system version
10
Additional context
No response
Issue checklist
The text was updated successfully, but these errors were encountered: