Skip to content

Commit c1d2aea

Browse files
committed
Compiler flag to specify line ending microsoft#1693 code review adjustments
1 parent 16d7e5c commit c1d2aea

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

Diff for: src/compiler/commandLineParser.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ module ts {
6868
},
6969
{
7070
name: "newLine",
71-
type: { "crlf": NewLineKind.CRLF, "lf": NewLineKind.LF },
71+
type: { "crlf": NewLineKind.CarriageReturnLineFeed, "lf": NewLineKind.LineFeed },
7272
description: Diagnostics.Emit_newline_Colon_CRLF_dos_or_LF_unix,
7373
paramType: Diagnostics.NEWLINE,
7474
error: Diagnostics.Argument_for_newLine_option_must_be_CRLF_or_LF

Diff for: src/compiler/diagnosticMessages.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2006,7 +2006,7 @@
20062006
"category": "Message",
20072007
"code": 6062
20082008
},
2009-
"Argument for --newLine option must be 'CRLF' or 'LF'.": {
2009+
"Argument for 'newLine' option must be 'CRLF' or 'LF'.": {
20102010
"category": "Error",
20112011
"code": 6063
20122012
},

Diff for: src/compiler/program.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,11 @@ module ts {
9191
}
9292
}
9393

94-
let newLine = [sys.newLine, "\r\n", "\n"][options.newLine ? Number(options.newLine) : 0];
95-
94+
let newLine =
95+
options.newLine === NewLineKind.CarriageReturnLineFeed ? "\r\n" :
96+
options.newLine === NewLineKind.LineFeed ? "\n" :
97+
sys.newLine;
98+
9699
return {
97100
getSourceFile,
98101
getDefaultLibFileName: options => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), getDefaultLibFileName(options)),

Diff for: src/compiler/types.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1691,9 +1691,8 @@ module ts {
16911691
}
16921692

16931693
export const enum NewLineKind {
1694-
DEFAULT = 0,
1695-
CRLF = 1,
1696-
LF = 2,
1694+
CarriageReturnLineFeed = 0,
1695+
LineFeed = 1,
16971696
}
16981697

16991698
export interface LineAndCharacter {

0 commit comments

Comments
 (0)