From c3d1986932a07cd5dc99b0b38baba8c68b6760cb Mon Sep 17 00:00:00 2001 From: Robert O'Rourke Date: Fri, 7 Jun 2019 13:51:02 +0100 Subject: [PATCH] use OS EOL if lineEnding is set to auto --- src/extension.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index 03a12bc..39f98d6 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -50,6 +50,8 @@ const ANCHOR_MODE_LIST = "gitlab.com" ] +const EOL = require('os').EOL; + export function activate(context: ExtensionContext) { // create a MarkdownTocTools @@ -267,7 +269,10 @@ class MarkdownTocTools { let lineEnding = workspace.getConfiguration("files").get("eol"); let tabSize = workspace.getConfiguration("[markdown]")["editor.tabSize"]; let insertSpaces = workspace.getConfiguration("[markdown]")["editor.insertSpaces"]; - + + if (lineEnding === 'auto') { + lineEnding = EOL; + } if(tabSize === undefined || tabSize === null) { tabSize = workspace.getConfiguration("editor").get("tabSize"); }