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

Display mixed line endings explicitly in status bar as "LF (mixed)" or "CRLF (mixed)" #119025

Open
geekley opened this issue Mar 15, 2021 · 8 comments
Labels
editor-textbuffer Editor text buffer feature-request Request for new features or functionality
Milestone

Comments

@geekley
Copy link

geekley commented Mar 15, 2021

When opening a file with mixed line endings, vscode is still showing it as LF or CRLF in the status bar.
After saving, it fixes it, but I think it should show, for example, LF (mixed) (maybe with squiggle or ⚠️ icon) until the file is modified.
This is important so that you know the file still has mixed EOLs, and you might want to fix that.

To reproduce: printf "lf\ncrlf\r\ncr\rnone" > mixed-eol.txt && code mixed-eol.txt
If you open this file in Notepad++ and enable visible EOL, you can see it has mixed endings.

(Posted from #12223 (comment) as separate issue.)

@geekley
Copy link
Author

geekley commented Mar 15, 2021

You might also want to display a confirmation dialog when saving, before auto-fixing the mixed line-endings, just to avoid unexpected/unwanted automatic behavior when user is just doing a simple edit operation (specially if they happen to open a binary file as text).

The confirmation dialog could have buttons Use LF, Use CRLF, Leave mixed and Cancel, so that the user makes an explicit choice in this case. The main/primary button may be the one used the most on the file. If the user chooses Leave mixed, the file is saved retaining mixed EOL (only new lines are added like shown in status bar), and that choice is remembered for that file until session ends.

@alexdima alexdima added editor-textbuffer Editor text buffer feature-request Request for new features or functionality labels Mar 19, 2021
@microestc
Copy link

Yes, I'm sure it's useful. a file contains a LF CRLF mix of cases, and I don't want to convert to a particular one in exceptional cases

@microestc
Copy link

When a file contains a mixture of lf and crlf, I don't want to change any lf or crlf changes when I save and format the code, but now the reality is that it changes automatically

@sujingang
Copy link

当文件包含lf和crlf的混合时,我不想在保存和格式化代码时更改任何lf或crlf更改,但现在的现实是它会自动更改

I also find it useful, especially when it comes to git code, always thinking that I have changed a lot of places.

@alexdima alexdima removed their assignment May 10, 2022
@AriESQ
Copy link

AriESQ commented May 15, 2022

Not having the ability to show newlines, CR/LF, EOF is bad for both beginners and experienced developers. I mention this because there is a lot of positioning of vScode as a solution for beginners.

@nic-r
Copy link

nic-r commented Sep 5, 2022

any plan on this feature

@mcrossley
Copy link

Still nothing?

@mcrossley
Copy link

I'd still really like this. It is a feature of Visual Studio I really miss in VSC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-textbuffer Editor text buffer feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

8 participants
@mcrossley @nic-r @alexdima @AriESQ @geekley @microestc @sujingang and others