Reformat files after changing tab size

My current tab size in my account options is 2. Let’s say I want to change it to 4.

Is there any easy way to reformat my files to tab size 4? Like a key bind to reformat the current file or something project-wise.

I use Alt-Shift-F. This uses the Ruff reformatter, recently added to the IDE.

2 Likes

Control-I will also fix just the tabs, if you like all the other formatting and just want to fix the tabs.

3 Likes

And there’s a special formatting option if you go to “look and feel” settings
Turn on auto format on save.
Now ctrl/cmd S will also auto format your code

The other option is to open up your project locally and run ruff format which will also apply 4 space indenting by default across all your files.

3 Likes

I think I will create a Feature Request to allow multiple answers as Solution for a question in the forum. All of your answers were great! Thank you so much!

I knew I read something about this as soon as the option to change tab size was released, but I was too lazy to use it at the time and now I couldn’t find anywhere. Thanks again @p.colbert , @jshaffstall and @stucork .

4 Likes

Reference: Anvil Docs | Keyboard Shortcuts

1 Like