-
Notifications
You must be signed in to change notification settings - Fork 509
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
Review and update code fixers to use correct new line character sequence #3656
Comments
I would vote for ignoring any config files and auto-detecting the wanted new line sequence for all analyzers, like the proposed solution for #3360. |
According to a comment Roslyn formats codefixes. |
What is the advantage of that approach? I mean if a user specifies in |
@MartyIX It could be specified there, or in a .globalconfig, or as an IDE setting. Simply adapting to what is already used would make it work without having to worry about different ways of configuring newlines. As long as the file is consistent, that is. But if it's not, then would this shortcut really make it worse? :-) Just an idea. |
Very interesting @manfred-brands. I have seen "elastic" being mentioned, but I have apparently not understood. Will check it out! |
Also see this comment regarding the probably incomplete method for detecting the actually used newline sequence, if more code fixers are updated to use it: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3607/files#r1237263110 |
It's not the responsibility of every analyzer to enforce line endings for the full file. Each code fix should only fix the issue at hand; even if a file deviates from the |
Elastic trivia is formatted by the IDE and the end of code fix applications. StyleCop Analyzers sometimes avoids using elastic trivia (e.g. via the |
There is a bunch of code fixers which either always use CRLF when adding line breaks, or get the character sequence from
document.Project.Solution.Workspace.Options.GetOption(FormattingOptions.NewLine, LanguageNames.CSharp)
and thereby fail to honor a end_of_line setting in .editorconfig.I see these:
I assume the primary updates should be to either look at surrounding text and use the existing new line sequence or read from an .editorconfig file. What is the wanted behaviour for the ones listed above?
The text was updated successfully, but these errors were encountered: