diff --git a/src/beautifiers/lua-beautifier/beautifier.coffee b/src/beautifiers/lua-beautifier/beautifier.coffee index 2cac5f1..2d413ab 100644 --- a/src/beautifiers/lua-beautifier/beautifier.coffee +++ b/src/beautifiers/lua-beautifier/beautifier.coffee @@ -28,6 +28,7 @@ DEFAULT_WARN_FN = (msg) -> module.exports = (str, indent, warn_fn, opts = {}) -> do_not_change_whitespace = !!opts?.do_not_change_whitespace + eol = opts?.eol or '\n' indent = indent or DEFAULT_INDENT warn_fn = if typeof warn_fn == 'function' then warn_fn else DEFAULT_WARN_FN indent = ' '.repeat(indent) if Number.isInteger(indent) @@ -102,4 +103,4 @@ module.exports = (str, indent, warn_fn, opts = {}) -> new_line or undefined warn_fn 'positive indentation at the end' if $currIndent > 0 - new_code.join '\n' + new_code.join eol diff --git a/src/beautifiers/lua-beautifier/index.coffee b/src/beautifiers/lua-beautifier/index.coffee index 7108863..e9d9445 100644 --- a/src/beautifiers/lua-beautifier/index.coffee +++ b/src/beautifiers/lua-beautifier/index.coffee @@ -16,6 +16,7 @@ module.exports = class Lua extends Beautifier } beautify: (text, language, options) -> + options.eol = @getDefaultLineEnding('\r\n','\n',options.end_of_line) new @Promise (resolve, reject) -> try resolve format text, options.indent_char.repeat(options.indent_size), @warn, options