-
Notifications
You must be signed in to change notification settings - Fork 508
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
Applying autofixes uses wrong line endings / should honour .editorconfig #3360
Comments
There are about 40 places in the code fixers that use |
For SA1513, I'd rather update it to match the newline already at the end of the line where the fix is being applied. Existing uses of |
.editorconfig
:Example.cs
:Applying the automatic fix for SA1513 (and probably a bunch of others, but this is the one where I tracked down the problem) inserts a CRLF (carriage return + line feed) combination, but the file uses LF only. In Visual Studio, you can observe the state of line endings for the current file in the bottom right corner of the file-editor pane. It should initially say
LF
, when the automatic fix is applied it will switch toMIXED
instead:The next time the file is opened (but not immediately when the problem is introduced!), Visual Studio will complain about mixed line endings, and suggest to 'normalize' the line endings (using the wrong default option, of-course):
The root-cause is probably because the fixer appears to use a hard-coded CRLF (SyntaxFactory.CarriageReturnLineFeed) rather than the currently configured line-end character.
The text was updated successfully, but these errors were encountered: