Browse Source

fix(emf-general-ls): fix black, add lua-fmt (#264)

Tim Bedard 4 years ago
parent
commit
82aeecdb10
1 changed files with 12 additions and 2 deletions
  1. 12 2
      lua/lsp/efm-general-ls.lua

+ 12 - 2
lua/lsp/efm-general-ls.lua

@@ -13,7 +13,7 @@ local flake8 = {
 local isort = {formatCommand = "isort --quiet -", formatStdin = true}
 local isort = {formatCommand = "isort --quiet -", formatStdin = true}
 
 
 local yapf = {formatCommand = "yapf --quiet", formatStdin = true}
 local yapf = {formatCommand = "yapf --quiet", formatStdin = true}
-local black = {formatCommand = "black --quiet --stdin-filename ", formatStdin = true}
+local black = {formatCommand = "black --quiet -", formatStdin = true}
 
 
 if O.python.linter == 'flake8' then table.insert(python_arguments, flake8) end
 if O.python.linter == 'flake8' then table.insert(python_arguments, flake8) end
 
 
@@ -27,12 +27,22 @@ end
 
 
 -- lua
 -- lua
 local lua_arguments = {}
 local lua_arguments = {}
+
 local luaFormat = {
 local luaFormat = {
     formatCommand = "lua-format -i --no-keep-simple-function-one-line --column-limit=120",
     formatCommand = "lua-format -i --no-keep-simple-function-one-line --column-limit=120",
     formatStdin = true
     formatStdin = true
 }
 }
 
 
-if O.lua.formatter == 'lua-format' then table.insert(lua_arguments, luaFormat) end
+local lua_fmt = {
+    formatCommand = "luafmt --indent-count 2 --line-width 120 --stdin",
+    formatStdin = true
+}
+
+if O.lua.formatter == 'lua-format' then
+  table.insert(lua_arguments, luaFormat)
+elseif O.lua.formatter == 'lua-fmt' then
+  table.insert(lua_arguments, lua_fmt)
+end
 
 
 -- sh
 -- sh
 local sh_arguments = {}
 local sh_arguments = {}