Преглед изворни кода

update for yaml must have prettier globally isntalled

Chris пре 4 година
родитељ
комит
0295b6345d
1 измењених фајлова са 5 додато и 2 уклоњено
  1. 5 2
      lua/lsp/efm-general-ls.lua

+ 5 - 2
lua/lsp/efm-general-ls.lua

@@ -15,6 +15,8 @@ local luaFormat = {
 -- JavaScript/React/TypeScript
 -- JavaScript/React/TypeScript
 local prettier = {formatCommand = "./node_modules/.bin/prettier --stdin-filepath ${INPUT}", formatStdin = true}
 local prettier = {formatCommand = "./node_modules/.bin/prettier --stdin-filepath ${INPUT}", formatStdin = true}
 
 
+local prettier_yaml = {formatCommand = "prettier --stdin-filepath ${INPUT}", formatStdin = true}
+
 local eslint = {
 local eslint = {
     lintCommand = "./node_modules/.bin/eslint -f unix --stdin --stdin-filename ${INPUT}",
     lintCommand = "./node_modules/.bin/eslint -f unix --stdin --stdin-filename ${INPUT}",
     lintIgnoreExitCode = true,
     lintIgnoreExitCode = true,
@@ -39,7 +41,7 @@ local shfmt = {
 require"lspconfig".efm.setup {
 require"lspconfig".efm.setup {
     -- init_options = {initializationOptions},
     -- init_options = {initializationOptions},
     init_options = {documentFormatting = true, codeAction = false},
     init_options = {documentFormatting = true, codeAction = false},
-    filetypes = {"lua", "python", "javascriptreact", "javascript", "sh", "html", "css", "json"},
+    filetypes = {"lua", "python", "javascriptreact", "javascript", "sh", "html", "css", "json", "yaml"},
     settings = {
     settings = {
         rootMarkers = {".git/"},
         rootMarkers = {".git/"},
         languages = {
         languages = {
@@ -50,7 +52,8 @@ require"lspconfig".efm.setup {
             sh = {shellcheck, shfmt},
             sh = {shellcheck, shfmt},
             html = {prettier},
             html = {prettier},
             css = {prettier},
             css = {prettier},
-            json = {prettier}
+            json = {prettier},
+            yaml = {prettier_yaml},
         }
         }
     }
     }
 }
 }