[clang] [clang-format] extend clang-format directive with options to prevent formatting for one line (PR #118566)
Paul Hoad via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 17 03:26:34 PST 2024
phoad107185 wrote:
> > I struggle with changes that encourage people to not be fully clang-formatted, I would prefer to ask why we need this feature, can we have some examples of where this would be used?
>
> This makes it so only one line isn't formatted instead of the current solution which is 2 lines unformatted. Additionally, if you start writing code in between the unformatted region you inherit the unformatted scope. Being able to disable the formatter for only a single line means the formatter will be disabled for the shortest amount of code possible.
While I understand the reason I would ask again, what exactly are you disabling on a single line and why? Does the clang-format team really want to maintain more reasons to "not" format code? I would rather put the effort into understanding why you are having to use the // clang-format off in the first place
I work on a project (in my day job) with millions of lines of code, EVERY file is 100% clang-formatted, without any // clang-format off statements. When I hit a problem I report it against clang-format or even submit a fix.
So again to reiterate my question why do we need this feature? what is the reason and why doesn't the current capabilities support what you need.
https://github.com/llvm/llvm-project/pull/118566
More information about the cfe-commits
mailing list