Skip to content
This repository has been archived by the owner on Oct 17, 2018. It is now read-only.

add setting for default new file line endings #7

Merged
merged 5 commits into from
Oct 14, 2015

Conversation

clintwood
Copy link
Contributor

This PR resolves #5 by enabling setting the default line endings for new files as shown below.

Setting Effect
OS Default Use the OS to determine which line ending to use for new files
LF Use '\n' for new files
CRLF Use '\r\n' for new files

This is purely for new files and does not affect changes made after the new file has been created and contains text.

@oh-ren
Copy link

oh-ren commented Oct 9, 2015

So.. Is this going in? (People want/need this.. ;))

type: 'string',
'default': 'OS Default',
enum: ['OS Default', 'LF', 'CRLF'],
descrition: 'Default line ending for new documents'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: descrition -> description.

@maxbrunsfeld
Copy link
Contributor

@clintwood Thanks for adding this! Could you (or anybody who is interested) add a test for this functionality? You could expand this test to cover the cases where line-ending-selector.defaultLineEnding is set to LF and CRLF.

@@ -10,6 +10,16 @@ const LineEndingRegExp = /\r\n|\n/g

let disposables = null

export let config = {
defaultNewFileLineEnding: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think defaultNewFileLineEnding is a bit verbose as a name. How do you feel about changing it to defaultLineEnding?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, was to be explicit about the fact that it was just applied for new files.

Will update PR.

@clintwood
Copy link
Contributor Author

Regarding the tests, I'm up against hard deadline ATM, and can only update tests realistically early January. Happy to accept patches which I can check and push!

@clintwood
Copy link
Contributor Author

Ok, I had a quick hack on the tests, please let me know if that covers the changes for this PR.

@maxbrunsfeld
Copy link
Contributor

@clintwood These tests look very nice. Great work!

maxbrunsfeld pushed a commit that referenced this pull request Oct 14, 2015
add setting for default new file line endings
@maxbrunsfeld maxbrunsfeld merged commit eccf9c9 into atom:master Oct 14, 2015
@clintwood
Copy link
Contributor Author

Cool!

@maxbrunsfeld
Copy link
Contributor

This will be in the next Atom release.

@PatSmuk
Copy link

PatSmuk commented Feb 28, 2016

Did this ever make into Atom? Would be quite useful.

@clintwood
Copy link
Contributor Author

@Patman64, I can confirm it is in the version I'm running 1.5.3, but I would assume it landed quite a while before this version!

@PatSmuk
Copy link

PatSmuk commented Mar 1, 2016

OK, just found the option. For anyone who finds this in the future, you have to go to File -> Settings -> Packages -> line-ending-selector -> Settings -> Default line ending for new files. Thanks @clintwood.

@clintwood clintwood deleted the new-file-default branch March 1, 2016 05:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add setting to set default line-endings for new files
5 participants