Skip to content

Commit 9021fc6

Browse files
authored
Merge pull request #115 from vegansk/114-default-eol
Use host EOL by default, fixes #114
2 parents 35c6b6a + 1c210fe commit 9021fc6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import * as tsconfigjson from "./provider/tsconfigjson";
1212
import * as editorconfig from "./provider/editorconfig";
1313
import * as tslintjson from "./provider/tslintjson";
1414
import * as vscodesettings from "./provider/vscodesettings";
15+
import { EOL } from "os";
1516

1617
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, "../package.json")).toString());
1718
export const version = packageJson.version;
@@ -163,7 +164,7 @@ export function processString(fileName: string, content: string, opts: Options):
163164
}
164165
processor.addPostProcess((_fileName: string, formattedCode: string, _opts: Options, formatSettings: ts.FormatCodeSettings) => {
165166
// replace newline code. maybe NewLineCharacter params affect to only "new" newline by language service.
166-
formattedCode = formattedCode.replace(/\r?\n/g, formatSettings.newLineCharacter || "\n");
167+
formattedCode = formattedCode.replace(/\r?\n/g, formatSettings.newLineCharacter || EOL);
167168
return Promise.resolve(formattedCode);
168169
});
169170

0 commit comments

Comments
 (0)