Compiler flag to specify line ending #1693

This commit is contained in:
Keith Mashinter
2015-05-03 02:07:03 -04:00
committed by kmashint
parent 1625a6c314
commit 532f92b88f
5 changed files with 32 additions and 1 deletions
+7
View File
@@ -66,6 +66,13 @@ module ts {
paramType: Diagnostics.KIND,
error: Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_or_umd
},
{
name: "newLine",
type: { "crlf": NewLineKind.CRLF, "lf": NewLineKind.LF },
description: Diagnostics.Emit_newline_Colon_CRLF_dos_or_LF_unix,
paramType: Diagnostics.NEWLINE,
error: Diagnostics.Argument_for_newLine_option_must_be_CRLF_or_LF
},
{
name: "noEmit",
type: "boolean",
@@ -502,6 +502,9 @@ module ts {
Preserve_new_lines_when_emitting_code: { code: 6057, category: DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." },
Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: DiagnosticCategory.Message, key: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." },
File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: DiagnosticCategory.Error, key: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." },
Emit_newline_Colon_CRLF_dos_or_LF_unix: { code: 6061, category: DiagnosticCategory.Message, key: "Emit newline: 'CRLF' (dos) or 'LF' (unix)." },
NEWLINE: { code: 6062, category: DiagnosticCategory.Message, key: "NEWLINE" },
Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6063, category: DiagnosticCategory.Error, key: "Argument for --newLine option must be 'CRLF' or 'LF'." },
Variable_0_implicitly_has_an_1_type: { code: 7005, category: DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
Member_0_implicitly_has_an_1_type: { code: 7008, category: DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
+12
View File
@@ -1998,6 +1998,18 @@
"category": "Error",
"code": 6059
},
"Emit newline: 'CRLF' (dos) or 'LF' (unix).": {
"category": "Message",
"code": 6061
},
"NEWLINE": {
"category": "Message",
"code": 6062
},
"Argument for --newLine option must be 'CRLF' or 'LF'.": {
"category": "Error",
"code": 6063
},
"Variable '{0}' implicitly has an '{1}' type.": {
+3 -1
View File
@@ -91,6 +91,8 @@ module ts {
}
}
let newLine = [sys.newLine, "\r\n", "\n"][options.newLine ? Number(options.newLine) : 0];
return {
getSourceFile,
getDefaultLibFileName: options => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), getDefaultLibFileName(options)),
@@ -98,7 +100,7 @@ module ts {
getCurrentDirectory: () => currentDirectory || (currentDirectory = sys.getCurrentDirectory()),
useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
getCanonicalFileName,
getNewLine: () => sys.newLine
getNewLine: () => newLine
};
}
+7
View File
@@ -1656,6 +1656,7 @@ module ts {
locale?: string;
mapRoot?: string;
module?: ModuleKind;
newLine?: string;
noEmit?: boolean;
noEmitHelpers?: boolean;
noEmitOnError?: boolean;
@@ -1689,6 +1690,12 @@ module ts {
System = 4,
}
export const enum NewLineKind {
DEFAULT = 0,
CRLF = 1,
LF = 2,
}
export interface LineAndCharacter {
line: number;
/*