add lua-format

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

View File

@ -22,18 +22,6 @@
color_primary = ["#555555", 19, "darkblue"] color_primary = ["#555555", 19, "darkblue"]
color_primary_strong = ["#444444", 17, "darkblue"] color_primary_strong = ["#444444", 17, "darkblue"]
# color_primary_weak = ["#898fcb", 20, "blue"]
# color_primary = ["#7e84c6", 19, "darkblue"]
# color_primary_strong = ["#5c6191", 17, "darkblue"]
# color_primary_weak = ["#9f61c2", 20, "blue"]
# color_primary = ["#8132ad", 19, "darkblue"]
# color_primary_strong = ["#641b8d", 17, "darkblue"]
# color_primary_weak = ["#ff9800", 20, "blue"]
# color_primary = ["#d68000", 19, "darkblue"]
# color_primary_strong = ["#bc6200", 17, "darkblue"]
color_2_weak = ["#5e955e", 28, "darkgreen"] color_2_weak = ["#5e955e", 28, "darkgreen"]
color_2 = ["#008700", 22, "darkgreen"] color_2 = ["#008700", 22, "darkgreen"]
color_2_strong = ["#005a00", 22, "darkgreen"] color_2_strong = ["#005a00", 22, "darkgreen"]

View File

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