Open ysiivan opened 7 months ago
@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)
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