-
Notifications
You must be signed in to change notification settings - Fork 111
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
FormatCode adds line filled with spaces when run on .cc file #217
Comments
Can you confirm if clang-format is the actual formatter being used here? Tab complete after :FormatCode to see what formatters are installed and apply to .cc files, and check if running the one for clang-format has the same issue. |
Update: It is related to the presence of Setting that to false (or removing it) makes the bug go away. |
I have the same issue. Root of cause: llvm/llvm-project#108333 |
So I checked your repro, definitely a clang bug w/o any plausible way that could be "working as intended", but if they're neglecting to fix that it's possible codefmt could have a workaround in the meantime to detect wonky output with mystery trailing whitespace and strip it off. Or maybe always ensure a trailing newline on the input it sends. On affected files, does formatting a specific range give weird trailing whitespace or just |
Seems like they fixed the issue in llvm/llvm-project#108513. Great thanks to @owenca! Let's keep tracking the latest llvm release (maybe 19.1.1?) and update here when the change is landed. |
The fix llvm/llvm-project#109170 was landed in 19.1.1. |
Description
Running
:FormatCode
on a cpp source (not header) file causes a trailing line filled with whitespaces to appear at the end of the document.Running
:FormatCode
again and again removes and re-adds and removes and ... this line.Steps to reproduce
Open any .cc file (for example I use
base/run_loop.cc
from the chromium projectRun
:FormatCode
. Observe line with trailing whitespaces at the end of the fileRun
:FormatCode
. Observe line with trailing whitespaces at the end of the file is gone.Repeat
My Setup
:PlugUpdate
)Gif of the bug
Other things I tried
clang-format -i base/run_loop.cc
from the command line does not introduce these whitespaces, which is why I opened the bug againstvim-codefmt
and notclang-format
.Please let me know if you need any more information.
Thanks!
The text was updated successfully, but these errors were encountered: