Skip to content
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

C# auto-formatter changes line terminators #3831

Open
lorcanmooney opened this issue Jul 5, 2015 · 3 comments
Open

C# auto-formatter changes line terminators #3831

lorcanmooney opened this issue Jul 5, 2015 · 3 comments
Labels
Area-IDE Bug Feature Request IDE-CodeStyle Built-in analyzers, fixes, and refactorings IDE-Formatter Code formatter and/or smart indent
Milestone

Comments

@lorcanmooney
Copy link
Contributor

If I open a C# file which uses LF line endings and trigger a formatting operation (type a closing brace, format the document, etc.), any updated lines will have their terminators replaced with CRLF. Any new lines introduced will also use CRLF.

Depending on the tools being used, this can make for noisy code reviews, and having to go back and clean up these silent changes after the fact is inconvenient to say the least! It's especially unfortunate since the Visual Studio editor otherwise seems fairly smart about which type of terminator to use based on surrounding lines.

Existing lines should retain their line terminator, and, ideally, new lines should use some sort of heuristic, just like the VS editor.

@Pilchie Pilchie added this to the 1.1 milestone Jul 30, 2015
@Pilchie
Copy link
Member

Pilchie commented Jul 30, 2015

@mattwar you just added an API about line terminators. What do you think about doing "When in Rome?" instead.

@Pilchie Pilchie modified the milestones: 1.2, 1.1 Oct 15, 2015
@DustinCampbell DustinCampbell modified the milestones: 1.3, 1.2 Feb 23, 2016
@Pilchie Pilchie modified the milestones: 2.0 (RC), 1.3 May 27, 2016
@Pilchie Pilchie modified the milestones: 2.0 (Preview 5), 2.0 (RC) Sep 26, 2016
@Pilchie Pilchie modified the milestones: 2.0 (RTM), 2.0 (RC) Nov 2, 2016
@Pilchie Pilchie modified the milestones: 3.0, 2.0 (RTM) Jan 19, 2017
@jinujoseph jinujoseph modified the milestones: 16.0, Backlog Jan 21, 2019
@KirillOsenkov KirillOsenkov added IDE-CodeStyle Built-in analyzers, fixes, and refactorings Bug labels Aug 13, 2020
@KirillOsenkov
Copy link
Member

Might be related to #37292

@KirillOsenkov
Copy link
Member

See also my comment on #4284 (comment)

@CyrusNajmabadi CyrusNajmabadi added the IDE-Formatter Code formatter and/or smart indent label Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Bug Feature Request IDE-CodeStyle Built-in analyzers, fixes, and refactorings IDE-Formatter Code formatter and/or smart indent
Projects
None yet
Development

No branches or pull requests

8 participants