Fix #2014. Improve Lua beautifier indentation

This commit is contained in:
Glavin Wiechert 2018-03-01 23:30:12 -04:00
parent 14b5d6c31e
commit ae7372d89b
1 changed files with 10 additions and 3 deletions

View File

@ -11,13 +11,20 @@ module.exports = class Lua extends Beautifier
link: "https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/lua-beautifier/beautifier.coffee"
options: {
Lua: true
Lua: {
indent_size: true
indent_char: true
end_of_line: true
}
}
beautify: (text, language, options) ->
options.eol = @getDefaultLineEnding('\r\n','\n',options.end_of_line)
options.eol = @getDefaultLineEnding('\r\n','\n', options.end_of_line)
indentChar = options.indent_char or " "
indentSize = options.indent_size
indent = indentChar.repeat(indentSize)
new @Promise (resolve, reject) ->
try
resolve format text, options.indent_char.repeat(options.indent_size), @warn, options
resolve(format(text, indent, @warn, options));
catch error
reject error