Skip to content

tsconfig.json keeps getting converted to Unix line endings #216

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
joelspadin opened this issue Mar 31, 2015 · 11 comments
Closed

tsconfig.json keeps getting converted to Unix line endings #216

joelspadin opened this issue Mar 31, 2015 · 11 comments
Assignees

Comments

@joelspadin
Copy link

When I have tsconfig.json saved with Windows-style line endings (CRLF), and then I do almost anything within Atom (open a file, save a file, etc.), the file is rewritten with Unix-style line endings (LF). This is frustrating when your Git environment is set to check out files with Windows-style line endings.

@basarat basarat self-assigned this Apr 1, 2015
@basarat basarat closed this as completed in 075ebfa Apr 1, 2015
@basarat
Copy link
Member

basarat commented Apr 1, 2015

sorry about that. Fixed with v1.14.0 ❤️

@joelspadin
Copy link
Author

Thanks!

@msssk
Copy link

msssk commented Apr 1, 2015

For those of us who prefer LF, the "fixed" behavior is undesirable. I think this issue cannot be resolved to everyone's satisfaction until Atom itself is fixed - it uses LF, and has no option to change it. Atom should have a user preference for line endings, and atom-typescript should adopt that.

In the meantime, I feel like Atom packages should do what Atom does (LF).

@ChaosinaCan how do you handle editing code with Atom if you prefer CRLF? I use Atom on Windows and it always uses LF (which is fine by me, but it really should be configurable).

@basarat
Copy link
Member

basarat commented Apr 1, 2015

it uses LF

No, it takes a majority vote based on the contents of the file (I know for sure). If file is empty it uses os.EOL (I think).

@msssk
Copy link

msssk commented Apr 1, 2015

If file is empty it uses os.EOL (I think).

For new files, I am on Windows, and it uses LF. So it only adopts something other than LF if you open an existing file with different line endings.

@basarat
Copy link
Member

basarat commented Apr 1, 2015

For new files, I am on Windows, and it uses LF. S

You are right. Sorry. My bad.

@joelspadin
Copy link
Author

Correct. Atom appears to default to LF, but after I convert the file to CRLF, it uses CRLF from then on.

@msssk
Copy link

msssk commented Apr 1, 2015

Clearly, the rational thing to do is to follow suit from Atom and scan every file listed in tsconfig.json, count the line endings, tally the winner, and use that in tsconfig.json!

Or add your thoughts on the Atom issue:
atom/atom#2822

@joelspadin
Copy link
Author

Heh. Maybe a more rational way to follow Atom's behavior would be: if tsconfig.json doesn't exist, create it with LF. If it does exist, check what the first line ending in the file is and use that when you rewrite it.

@basarat
Copy link
Member

basarat commented Apr 1, 2015

Maybe a more rational way to follow Atom's behavior would be: if tsconfig.json doesn't exist, create it with LF. If it does exist, check what the first line ending in the file is and use that when you rewrite it.

@msssk if you agree create a new issue here for tracking (up for grabs). I am okay with this 👍

@msssk
Copy link

msssk commented Apr 1, 2015

I'd really like to see Atom make this user-configurable, but in the meantime if we can maintain the existing line endings I can at least update my atom-typescript package past 1.13!

I created #224 for this.

@TypeStrong TypeStrong locked and limited conversation to collaborators Jan 20, 2019
angelestelar5z added a commit to angelestelar5z/atom-typescript that referenced this issue Aug 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants