Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codefmt shouldn't call FormatRanges with empty a:ranges #50

Open
malcolmr opened this issue Jul 14, 2015 · 1 comment
Open

codefmt shouldn't call FormatRanges with empty a:ranges #50

malcolmr opened this issue Jul 14, 2015 · 1 comment
Labels

Comments

@malcolmr
Copy link
Member

As noted in #48, we seem to have some cases where a formatter's FormatRanges() will be invoked with an empty a:ranges. Either that, or we're unnecessarily checking for emptiness in the clang-format formatter.

Unless I'm missing something, this doesn't seem like it's useful; the interface with formatters should say that this is impossible, and we should remove the checks we have.

@dbarnett
Copy link
Contributor

I think I would want some kind of empty check in the clang-format code regardless, because otherwise there's a correctness issue: FormatRanges([X, Y]) means "format ranges X and Y", but FormatRanges([]) means "format entire buffer". Changing the empty check to a hard precondition and changing codefmt to never call with empty ranges should be fine.

@dbarnett dbarnett added the bug label Mar 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants