From cc4da2fb2d4acfbb9894982bbda2e0cba2f71edc Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Sat, 2 Apr 2022 10:51:56 +0200 Subject: [PATCH] feat: enable javascript formatting --- nvim/lua/plugins/lspconfig.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/nvim/lua/plugins/lspconfig.lua b/nvim/lua/plugins/lspconfig.lua index 5a2104c..680c3aa 100644 --- a/nvim/lua/plugins/lspconfig.lua +++ b/nvim/lua/plugins/lspconfig.lua @@ -22,7 +22,7 @@ end local extra_server_opts = { ["efm"] = function(opts) opts.filetypes = { - "lua", "html", "markdown", "typescript", "typescriptreact" + "lua", "html", "javascript", "markdown", "typescript", "typescriptreact" } opts.init_options = {documentFormatting = true} opts.settings = { @@ -30,8 +30,16 @@ local extra_server_opts = { languages = { lua = {{formatCommand = "lua-format -i", formatStdin = true}}, html = { - formatCommand = "yarn run --silent prettier --stdin-filepath ${INPUT} --parser html", - formatStdin = true + { + formatCommand = "yarn run --silent prettier --stdin-filepath ${INPUT} --parser html", + formatStdin = true + } + }, + javascript = { + { + formatCommand = "prettier --stdin-filepath ${INPUT}", + formatStdin = true + } }, typescript = { {