feat: use lua-format and prettier via efm

This commit is contained in:
Michael Mandl 2022-02-22 11:19:24 +01:00
parent b20b0afb88
commit 39153f91c1
Signed by: mandlm
GPG key ID: 4AA25D647AA54CC7

View file

@ -21,13 +21,36 @@ end
local extra_server_opts = { local extra_server_opts = {
["efm"] = function(opts) ["efm"] = function(opts)
opts.filetypes = {"lua"} opts.filetypes = {
"lua", "html", "markdown", "typescript", "typescriptreact"
}
opts.init_options = {documentFormatting = true} opts.init_options = {documentFormatting = true}
opts.settings = { opts.settings = {
rootMarkers = {".git/"}, rootMarkers = {".git/"},
languages = { languages = {
lua = {{formatCommand = "lua-format -i", formatStdin = true}} lua = {{formatCommand = "lua-format -i", formatStdin = true}},
html = {
{formatCommand = "yarn run --silent prettier --parser html"}
},
typescript = {
{
formatCommand = "yarn run --silent prettier --parser typescript"
}
},
typescriptreact = {
{
formatCommand = "yarn run --silent prettier --parser typescript"
}
},
markdown = {
{
formatCommand = "yarn run --silent prettier --parser markdown"
}
}
} }
-- prettier-parser
-- flow|babel|babel-flow|babel-ts|typescript|espree|meriyah|css|
-- less|scss|json|json5|json-stringify|graphql|markdown|mdx|vue|yaml|glimmer|html|angular|lwc
} }
end, end,
["sumneko_lua"] = function(opts) ["sumneko_lua"] = function(opts)