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

Dont normalize line endings in the cli #90

Open
DavisVaughan opened this issue Dec 10, 2024 · 0 comments · May be fixed by #127
Open

Dont normalize line endings in the cli #90

DavisVaughan opened this issue Dec 10, 2024 · 0 comments · May be fixed by #127

Comments

@DavisVaughan
Copy link
Collaborator

DavisVaughan commented Dec 10, 2024

// TODO: We rarely ever take advantage of this optimization on Windows right
// now. We always normalize on entry but we apply the requested line ending
// on exit (so on Windows we often infer CRLF on entry and normalize to
// LF, but apply CRLF on exit so `source` and `new` always have different
// line endings). We probably need to compare pre-normalized against
// post-formatted output?
//
// Ah, no, the right thing to do is for the cli to not care about normalizing
// line endings. This is mostly useful in the LSP for all the document manipulation
// we are going to do there. In the cli, we want to format a whole bunch of files
// so we really want this optimization, and since the formatter and parser can handle
// windows line endings just fine, we should not normalize here.

Will require normalize_string() in the formatter for multiline strings

rome/tools#1672 is the old rome PR that allows this to work right. What i missed before is that on the way out of the formatter the printer normalizes all line endings one final time to whatever LineEnding is set as. So it is impossible to get mixed line endings on the way out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant