Atom-beautify: Beautify on save changes LF to CRLF if working on Windows

Created on 4 Aug 2016  路  9Comments  路  Source: Glavin001/atom-beautify

Description

I am working on both Mac and Windows. In order to avoid problems with diffing and versioning, I'd like to use the same line feed on both systems (LF). I can change this by clicking on the statusbar in Atom. But as soon as I save the file on Windows, all LF are automatically converted to CRLF. If I disable Beautify on Save, everything works as expected, so the problem is in the atom-beautify package.

Expected Results

Line feeds are kept as defined in Atom's statusbar.

Steps to Reproduce

  1. Create a file on a Mac system using LF
  2. Open it on a Windows system
  3. Save it there, with Beautify on Save enabled
third-party-bug

Most helpful comment

My colleague was having the problem with the same project I was working on and we're both on windows 10. This project is forced to lf via a .gitattributes file.

The culprit was the line-ending-selector core package Default line ending option which was set to OS default on my colleague's computer.

All 9 comments

My case is that I'm using atom on windows and eslint airbnb rules (eslint-config-airbnb-base) which enforce LFs in javascript files. I've searched high and low for the right option/parameter/configuration, but beautification always switches EOLs to CRLF.

Maybe this is right because git will commit with LFs, and I should just disable the rule... I don't know.

same here any ideas?

Not sure why this was classified as an "enhancement". If the package overrides line-feeds unwantedly, IMHO this is a defect. I wouldn't mind if this wasn't limiting interchanging files between platforms substentially. Causes a lot of problems with diffing - and especially merging.

I have the same problem I need that all the files be enforce to LFs and when I use atom beautify change to CRLF....It's very frustrating. I have the eol to \n and its not working.

Could everyone please post their debug.md Gist so I could help debug this. Thank you.
See https://github.com/Glavin001/atom-beautify/blob/master/docs/troubleshooting.md for instructions.

here it's the debug.md from an example
https://gist.github.com/anonymous/a55fdc272657e21cce6d3461eab5b697

The file was with 2 space and LF and change to 4 spaces (correct) and CRLF (wrong)

I'm using editorconfig with this configuration.

root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

I was doing some test and that problem it's just with .js files with html for example works fine using js-prettify

My colleague was having the problem with the same project I was working on and we're both on windows 10. This project is forced to lf via a .gitattributes file.

The culprit was the line-ending-selector core package Default line ending option which was set to OS default on my colleague's computer.

@emileber Thanks for the hint to the line-ending-selector package. This setting helped me, too.

I'm closing this as resolved by reconfiguring line-ending-selector package. Please let me know if this is incorrect assessment and this issue can be reopened. Thanks!

Was this page helpful?
0 / 5 - 0 ratings