From 1c210fe3e89259e96e4571750f481b9c70f43e03 Mon Sep 17 00:00:00 2001 From: Anatoly Galiulin Date: Thu, 26 Oct 2017 16:09:34 +0700 Subject: [PATCH] Use host EOL by default #114 --- lib/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/index.ts b/lib/index.ts index 8fadf16..5c85277 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -12,6 +12,7 @@ import * as tsconfigjson from "./provider/tsconfigjson"; import * as editorconfig from "./provider/editorconfig"; import * as tslintjson from "./provider/tslintjson"; import * as vscodesettings from "./provider/vscodesettings"; +import { EOL } from "os"; const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, "../package.json")).toString()); export const version = packageJson.version; @@ -163,7 +164,7 @@ export function processString(fileName: string, content: string, opts: Options): } processor.addPostProcess((_fileName: string, formattedCode: string, _opts: Options, formatSettings: ts.FormatCodeSettings) => { // replace newline code. maybe NewLineCharacter params affect to only "new" newline by language service. - formattedCode = formattedCode.replace(/\r?\n/g, formatSettings.newLineCharacter || "\n"); + formattedCode = formattedCode.replace(/\r?\n/g, formatSettings.newLineCharacter || EOL); return Promise.resolve(formattedCode); });