Skip to content

Use host EOL by default, fixes #114 #115

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

Merged
merged 1 commit into from
Oct 27, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
});

Expand Down