-
Notifications
You must be signed in to change notification settings - Fork 13
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
[BUG] cshtml formatter keeps adding blank lines #963
Comments
@jordi1215 is this now fixed? I remember you had something similar.... |
happens to me as well fyi ... and I like to auto format so I end up with a ton of empty lines usually after a @foreach() ... any workarounds ? I have tried adding comments and poking at it but seems to add lines reliably ! |
Still happening for me as well (only using the C# extension, without devkit) on my windows machine only (since I set it up to also use LF to be consistent with my linux machine) |
We believe that this issue was fixed with the C# VS Code extension version 2.49.25, released on October 8th 2024 (See PR: dotnet/razor#10802). If any of you experience the same or a similar issue, please let us know. Thanks! |
Describe the Issue
In some cases when saving (or anything that triggers formatting, I guess) a *.cshtml file in VS Code, blank lines are being added in some places with each save.
The user might not even notice that their file is growing. In my case, a fragment near the bottom of the page got blown so much that in a week or so the file grew by dozens of thousands of rows.
Appears to be a bug in the formatter that perhaps does not properly work with line endings.
Steps To Reproduce
VS Code on Windows working on code base with Unix line endings (
LF
).The issue was not observed in Linux or in Windows when the file has Windows line endings {
CRLF
).I have this near the end of one of my Razor pages:
After one save, it looks like this
After two saves:
and so on
Expected Behavior
Blank lines should not be added. The formatter should work correctly with either
LF
orCRLF
files regardless of the OS VS Code is being used on.Environment Information
Windows 11
The text was updated successfully, but these errors were encountered: