Does a pragma exist to switch off `mojo format`
I love the convention part of source code formatting rules: teams should not argue (too much) about formatting. Do this discussion once, agree on something that works for everyone (convention). Let the standard tooling handle it.
However, teams often agree that it needs to be switched off sometimes.
Question: Is there something to switch off sections of code that should not be formatted. A
@format on/off
would do.4 Replies
Before I make a feature request, I searched the manuals, found nothing, but experience has it that that is no guarantee it doesn't exist. Blame my daft head.
I think the formatter is based on black, thus you should check the black manual for this
Because it took me a while to find in the black docs (yes, "basics" was the last place I looked ...): https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#ignoring-sections
Yes, that's it! Thus
# fmt: off
to switch it off (captain obvious), and # fmt: on
to switch it on.