How hard is it to rebuild `zig fmt` so it indents with the tab character instead of 4 spaces for a Zig newcomer?

Indentation with spaces looks horrible with the renderWhitespace setting in VSCodium.

How hard is it to rebuild zig fmt so it indents with the tab character instead of 4 spaces for a Zig newcomer?

It wouldn’t be hard. but pretty pointless. Better for the newcomer to embrace the language than fight it.

9 Likes

The Cubyz project seems to do this by maintining a custom version of zig fmt. That seems like it would introduce a lot of extra work though.

I agree with @pachde, when in Rome…

3 Likes

Besides, rendering whitespace is more or less pointless when you know that there can’t be any tabs.

3 Likes

Cubyz maintainer here, it’s actually not that hard. You can see the full list of changes here: Apply changes to run the formatter in the Cubyz codebase · ziglang/zig@83e3b93 · GitHub and that includes other formatting changes too. The only hard part is that it requires changing the standard library, since the formatting code is in the std lib.

3 Likes

I didn’t ask about what’s better and what’s pointless.
Thank you for you effort.

Thank you for you insight.

I didn’t ask about what’s pointless and what’s not.
Thank’s for the effort.

Thank you very much!
This is the answer I was looking for.