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

tsc compiler option for --newLine NEWLINE Use newline: 'CRLF' (dos) or 'LF' (unix). #2918

Closed
kmashint opened this issue Apr 25, 2015 · 7 comments
Labels
Question An issue which isn't directly actionable in code

Comments

@kmashint
Copy link
Contributor

I have an patch to TypeScript compiler options to solve issues with different newlines as in this item:
https://typescript.codeplex.com/workitem/258

It adds this option to tsc, and uses it in program.ts / createCompilerHost() / getNewline():
--newLine NEWLINE Use newline: 'dos' or 'unix'.

I've signed the Contributor License Agreement (CLA) and I'm working on test cases but what is the next step to be allowed to push a branch and/or create a pull request?

Thanks to all for TypeScript, and I hoping to eliminate the newline conflicts at the source for mixed development environments of Mac, Linux/UNIX, Windows.

@DanielRosenwasser DanielRosenwasser added the Question An issue which isn't directly actionable in code label Apr 25, 2015
@DanielRosenwasser
Copy link
Member

Hey @kmashint, thanks for checking in with us. Here's some steps you might want to check:

  1. Read our CONTRIBUTING.md.
  2. As described in the above, make sure you follow the Coding Guidelines and in general try to stay canonical with our codebase.
  3. In your PR body (not title), clearly specify what issue you're aiming to resolve/fix (i.e. Compiler flag to specify line ending  #1693), and potentially link to this issue for reference as well.

For this feature specifically, ~2-3 tests for CRLF and LF line endings each might be decent. I'd put the tests in tests/cases/compiler and I'd name the tests something like newlineFlagWith[BlahBlah]CRLF.ts/newlineFlagWith[BlahBlah]LF.ts. For instance, one set of tests might be:

  • newLineFlagWithTemplateStringsCRLF.ts
  • newLineFlagWithTemplateStringsLF.ts.

In general, if there's an existing issue and the reception looks positive (or you just want to show a proof-of-concept and don't mind if it doesn't get pulled in), you can send out a PR. We'll try to give feedback on it and work with you.

@CyrusNajmabadi
Copy link
Contributor

i don't really like 'dos' and 'unix' as the names. Why not just be explict with things like cr, crlf, and lf ?

@DanielRosenwasser
Copy link
Member

i don't really like 'dos' and 'unix' as the names.

Agreed, use CRLF and LF as option names (don't include CR as an option).

@nycdotnet
Copy link

The open issue that is marked as accepting Pull Requests is here: #1693

@kmashint
Copy link
Contributor Author

Thanks, I took a survey and git is the only tool that refers to crlf and lf combinations. I'll change to use --newLine CRLF (or LF, lower-case also acceptable) although git is far from the best example of command-line options (what's the opposite of push? fetch, not pull... hmm...)

UNIX tools: dos2unix, unix2dos
vi, vim: set ff=dos, set ff=unix
Eclipse: workspace line delimiter Windows or UNIX
Notepad++ (Win): EOL: UNIX Format, Windows Format, Mac Format (old CR-only)
WinMerge: carriage return differences (DOS/UNIX/MAC)
git: options refer to crlf, lf, cr combinations

@kmashint kmashint changed the title tsc compiler option for --newLine NEWLINE Use newline: 'dos' or 'unix'. tsc compiler option for --newLine NEWLINE Use newline: 'CRLF' (dos) or 'LF' (unix). Apr 26, 2015
@CyrusNajmabadi
Copy link
Contributor

Git is nice, modern, and precise. For example, say that Windows moves to LF at some point. Now 'Windows' or 'Dos' is a complete misnomer. This is not speculative, look at how this happened with Apple. It used to be CR only for them, but then they moved to LF.

CRLF and LF is precise and indicate exactly what you'll be getting.

@kmashint
Copy link
Contributor Author

I hear you on git, but somewhere they lost track of the first part of the adage to "keep simple things simple and the complex possible".

@mhegazy mhegazy closed this as completed May 4, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

5 participants