-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Add line ending selector #35392
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
Add line ending selector #35392
Conversation
Can we have a setting to disable the indicator in the status bar? |
I don't think the other indicators on the status bar like the line/column position, vim mode, and language have a way of disabling them either, so I'm not sure how the Zed team would want something like that implemented. I'm not really sure what the setting would look like since they are indicators specific to buffers. I would think that these "buffer indicators" would be grouped together under one scope, rather than each having their own individual property at the root level of the settings. |
Understandable. The reason I'm asking that is, in my opinion, there are already too many buttons and indicators in the status bar, and since I don't care about the line ending 99% of the time, I would like to disable it (as I did in vscode). |
Thanks for this! I agree that we shouldn't show the line ending in the status bar. It is rarely useful. I don't think we even need a setting to enable it: what are the workflows where you continually need to know your files line-endings? If there are some we should try and figure out how to solve those, maybe Zed could respect the We do need some way to surface the current line ending, but I think that would be as simple as having the picker show a check-mark next to the currently selected item. |
5e0f6f9
to
42e3a60
Compare
For workflows where a line ending indicator would be beneficial, working on cross platform projects it is nice to quickly be able to see the line ending of a file without having to open up the selector. Having the option for the indicator would be nice and just defaulting with it disabled, but as you said the selector with the checkmark does work. I do agree that Zed should use the editor config property, currently when creating new file in a project it just uses the line ending of the system rather than what is used in the project, also a user setting is needed for the desired default line ending, could look into these in a separate PR. |
I guess so; though it's hopefully a very large minority of the time :D. The approach here seems reasonable to me (including without undo). I think we need to make it work over collab too (or less ideally disabling it in that case)? Do you feel comfortable doing that and adding a test? If not happy to pair: https://cal.com/conradirwin/pairing. |
I am not even sure I should be commenting on a PR but here it goes
Would having two commands, a setter and a getter that only displays the current line ending, be a reasonable approach? This way you would call "show line ending" command and read the current setting in a modal palette rather than having the space taken in the status bar. |
42e3a60
to
3cc2ccc
Compare
3cc2ccc
to
b742d18
Compare
I removed the line ending display from this PR to keep things simple. When selecting a line ending from the selector it will now save the buffer instead of marking it as dirty since that can cause confusion because you can't undo it. I added a test and the buffer operation |
Great, thank you! I pushed up a change that fixes the problem over collab (the defer is needed so that the save happens after the line ending change is propagated). I also removed the editor from the picker as it seemed unnecessary. Is there anything else you wanted to do before shipping this? |
80de41d
to
fd9fdf3
Compare
Thanks, nothing else, good to go! |
5b5bf18
to
f9976ee
Compare
Thanks! |
Partially addresses this issue #5294
Adds a selector between
LF
andCRLF
for the buffer's line endings, the checkmark denotes the currently selected line ending.Selector

Release Notes: