Review and update code fixers to use correct new line character sequence
See original GitHub issueThere 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:
- SA1102: Currently CRLF
- SA1103: Currently CRLF
- SA1104: Currently CRLF
- SA1107: Currently CRLF
- SA1116: Currently CRLF
- SA1127: Currently CRLF
- SA1132: Currently CRLF
- SA1133: Currently CRLF
- SA1134: Currently CRLF
- SA1136: Currently CRLF
- SA1200, SA1208-SA1211, SA1216, SA1217 (UsingCodeFixProvider): Currently CRLF
- SA1201-SA1204, SA1214 (ElementOrderCodeFixProvider): Currently CRLF
- SA1212: Currently CRLF
- SA1213: Currently CRLF
- SA1500: Currently CRLF
- SA1501: Currently CRLF
- SA1502: Currently CRLF
- SA1504: Currently CRLF
- SA1507: Currently Workspace.Options
- SA1513: Currently CRLF (See #3360)
- SA1514: Currently CRLF
- SA1515: Currently CRLF
- SA1516: Currently CRLF
- SA1600: Currently Workspace.Options
- SA1609 Currently Workspace.Options
- SA1615: Currently Workspace.Options
- SA1642: Currently Workspace.Options
- SA1633-SA1638, SA1640, SA1641 (FileHeaderCodeFixProvider): Currently Workspace.Options (See #3247)
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?
Issue Analytics
- State:
- Created 4 months ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
New line counter for new line characters in string literals ...
First, it counts the quote marks in the length of the string literal, which is probably not correct. Second, it counts escape sequences...
Read more >Quick Fix for CRLF to LF does not work · Issue #707
Issue Type: Bug. I'm seeing a lint error after copying (some code in View Raw, in the browser) and pasting into a new...
Read more >Black Fails to Format Single String Longer Than Line ...
One possible solution is to break on the <line length limit minus 1> character and parenthesize if it is not already inside parentheses:...
Read more >enter new line in text string in saved file when appear carriage ...
Hi, i have concatenated string and i want to saved the file, i use 'write characters to file', but its saved the bad...
Read more >Solved: Replace Newline in Flow Expression
I initalied a variable string. In the string I hit enter so the only character in the string was a new line. I...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.
According to a comment Roslyn formats codefixes. This came up in the nunit.analyzers and as far as I tested it that seems to be the case.