Skip to content

Uniform line separator handling #775

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

Closed
matklad opened this issue Feb 10, 2019 · 3 comments
Closed

Uniform line separator handling #775

matklad opened this issue Feb 10, 2019 · 3 comments
Labels
E-hard fun A technically challenging issue with high impact

Comments

@matklad
Copy link
Member

matklad commented Feb 10, 2019

Linux and mac use \n for line endings, Windows uses \r\n, and we need to deal with it somehow.

Just using both wouldn’t work too well: we need to create edits to the documents, and worrying about line separators when editing code is too much of a hassle.

So we should use \n everywhere, and convert to \r\n at the boundary. Specifically, in the paerse query we should do the conversion in the “in” direction, and we should transform edits on the “out” direction.

@matklad matklad added E-hard fun A technically challenging issue with high impact labels Feb 10, 2019
@vipentti
Copy link
Contributor

This will probably require some state regarding the newlines that are being used. Meaning we can always transform all newlines to\n but doing the reverse transformation should know whether to keep the \n or transform them back to \r\n. I think ideally we would maintain original line endings with all edits, even if the file has mixed line endings.

@c410-f3r
Copy link
Contributor

Shouldn't the EOL conversion be handled inside ra_vfs? At least for the Editor -> Analyzer flow.

@matklad
Copy link
Member Author

matklad commented Feb 11, 2020

Fixed this a while ago.

@matklad matklad closed this as completed Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-hard fun A technically challenging issue with high impact
Projects
None yet
Development

No branches or pull requests

3 participants