Skip to content
This repository was archived by the owner on Jan 4, 2022. It is now read-only.

Commit 4e18b33

Browse files
committed
Fix issue when files.eol is set to auto
1 parent 64c2b35 commit 4e18b33

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,15 @@ export function getExtSettings<T>(key: string, defaultValue?: T): T {
4646
return getSettings<T>(CONFIGURATION_KEY, key, defaultValue);
4747
}
4848

49+
function getEndOfLine() {
50+
var endOfLine = getSettings<string>("files", "eol", "\n");
51+
var isValid = endOfLine == "\r\n" || endOfLine == "\n";
52+
return isValid ? endOfLine : "\n";
53+
}
54+
4955
export function getConfig() {
5056
const indentation = getSettings<boolean>("editor", "insertSpaces", false) ? " " : "\t";
51-
const endOfLine = getSettings<string>("files", "eol", "\n");
57+
const endOfLine = getEndOfLine();
5258

5359
const removeComments = getExtSettings<boolean>(CONFIGURATION_REMOVE_COMMENTS, false);
5460
const removeReports = getExtSettings<boolean>(CONFIGURATION_REMOVE_REPORTS, false);

0 commit comments

Comments
 (0)