add lua-format

This commit is contained in:
Ray Elliott 2021-09-06 13:24:28 +01:00
commit 5c336c9c12
2 changed files with 8 additions and 14 deletions

View file

@ -73,6 +73,11 @@ local jq = {
local fixjson = {
formatCommand = "fixjson"
}
-- https://aur.archlinux.org/packages/lua-format/
local luaformat = {
formatCommand = 'lua-formatt -i',
formatStdin = true
}
local util = require "lspconfig".util
local on_attach_efm = function(client)
if client.resolved_capabilities.document_formatting then
@ -85,7 +90,7 @@ end
require "lspconfig".efm.setup {
init_options = {documentFormatting = true},
on_attach = on_attach_efm,
filetypes = {"javascript", "typescript", "json", "sh", "python"},
filetypes = {"javascript", "typescript", "json", "sh", "python", "lua"},
root_dir = function(fname)
return util.root_pattern("tsconfig.json")(fname) or
util.root_pattern(".eslintrc.js", ".git")(fname);
@ -97,7 +102,8 @@ require "lspconfig".efm.setup {
typescript = {eslint},
json = {jq, fixjson},
python = {flake8, black},
sh = {shellcheck}
sh = {shellcheck},
lua = {luaformat}
}
}
}