From 39153f91c171bb72c3d990049c76771b1ed4a23e Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Tue, 22 Feb 2022 11:19:24 +0100 Subject: [PATCH] feat: use lua-format and prettier via efm --- lua/plugins/lspconfig.lua | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua index da98442..6c619d8 100644 --- a/lua/plugins/lspconfig.lua +++ b/lua/plugins/lspconfig.lua @@ -21,13 +21,36 @@ end local extra_server_opts = { ["efm"] = function(opts) - opts.filetypes = {"lua"} + opts.filetypes = { + "lua", "html", "markdown", "typescript", "typescriptreact" + } opts.init_options = {documentFormatting = true} opts.settings = { rootMarkers = {".git/"}, 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, ["sumneko_lua"] = function(opts)