Auto-format and indentation definition

The autoformat option in MBED Studio indents code by two spaces (like in Arduino IDE).
However, the tab button produces 4 spaces (which is I think the most conventional in programming).

The autoformat result does not match with normally edited code.

I would suggest to include a setting for tab definition (4 spaces by default), and apply that setting to both the auto formatter and the tab key.

On Windows 10, Mbed Studio 1.3.1

Hi Robert,

You can change indentation on the bottom bar (bottom-right corner in Studio). You should be able to change between tabs and spaces. Including setting the default tab definition (1-8 spaces).

Thanks,
Arek - Studio team

1 Like

Thank you for your reply.

Ah, I hadn’t noticed it, thanks.
But still, the auto-formatter ignores this setting: it formats everything with 2 spaces, even though the setting is at 4.

Is there any additional feedback on this?
I never understood why anyone would want to use space indentation, but whatever settings I adjust, Format Document will indent using two spaces regardless… It’s pretty annoying.

Yes I agree, the two-space indenting for auto-formatting is annoying. It would be nice if this matched the Tab Size setting.

Absolutely. The auto-formatter should consider the indentation setting. It’s really annoying!