nvim/lua/lsp/efm.lua
2022-07-08 04:03:03 +08:00

31 lines
1.1 KiB
Lua

-- 部分补全代码不支持autoformat 需使用efm自动补全
-- https://github.com/mattn/efm-langserver
return {
init_options = { documentFormatting = true },
filetypes = { 'python', 'json', 'css', 'yaml' },
settings = {
rootMarkers = { ".git/" },
languages = {
python = {
-- pip install yapf
{ formatCommand = "yapf --quiet", formatStdin = true }
},
json = {
-- yarn global add fixjson
{ formatCommand = "fixjson", formatStdin = true }
},
-- yarn global add yaml-lint
yaml = {
{ formatCommand = "yamllint -f parsable -", formatStdin = true }
},
css = {
-- yarn global add prettier
{ formatCommand = "prettier --tab-width=4 ${--single-quote:singleQuote} --parser css", formatStdin = true }
-- { formatCommand = "prettier ${--tab-width:tabWidth} ${--single-quote:singleQuote} --parser css", formatStdin = true }
}
}
}
}