-
Notifications
You must be signed in to change notification settings - Fork 112
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
Add option to touch only changed lines #9
Comments
BTW, fine-grained range formatting will be really annoying for formatters that don't natively support ranges, like gofmt. The hacks we use to approximate range formatting will show errors if the range starts or ends in the middle of a code block. We could just leave it to users whether they decide to enable it anyway, but I foresee frustrated users not understanding why it doesn't work and filing bugs about it. |
How about this?
It's just that for formatters which do support ranges, this feature is super useful, so I'd like to see it not held up. My annoyed code reviewers and I thank you in advance. :) |
Ugh, this is why all formatters should just have good range formatting support… I think I agree the fallback should be to format the whole file (only if the file was actually changed), but either way I'm expecting confused users reporting "that's not what I asked it to do". |
I don't know if you can win, I get confused when lines I didn't change are formatted, particularly in languages without a canonical formatter like gofmt. I tried using codefmt and it introduced a lot of format churn into my CLs. |
It would be nice to have a mode to detect which lines you had touched in this editing session and only format those ranges.
We'd need a way to decide between this behavior and formatting the whole buffer. One option would be a new
:FormatChangedLines
and:AutoFormatChangedLines
command that would work as variants of:FormatCode
and:AutoFormatBuffer
.The text was updated successfully, but these errors were encountered: