From 4a1ad02483052ac11d732f689bf051823d4c7f77 Mon Sep 17 00:00:00 2001 From: veypi Date: Sat, 30 Apr 2022 16:55:28 +0800 Subject: [PATCH] add json format --- lua/lsp/efm.lua | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lua/lsp/efm.lua b/lua/lsp/efm.lua index 9bbb49b..62dc5cc 100644 --- a/lua/lsp/efm.lua +++ b/lua/lsp/efm.lua @@ -1,15 +1,20 @@ -- 部分补全代码不支持autoformat 需使用efm自动补全 -- https://github.com/mattn/efm-langserver return { - init_options = {documentFormatting = true}, - filetypes = {'python'}, - settings = { - rootMarkers = {".git/"}, - languages = { + init_options = { documentFormatting = true }, + filetypes = { 'python', 'json' }, + settings = { + rootMarkers = { ".git/" }, + languages = { python = { -- pip install yapf - {formatCommand = "yapf --quiet", formatStdin = true} + { formatCommand = "yapf --quiet", formatStdin = true } + }, + json = { + -- yarn global add fixjson + { formatCommand = "fixjson", formatStdin = true } + } - } - } + } + } }