LunarVim.LunarVim/ftplugin/json.lua

30 lines
645 B
Lua
Raw Normal View History

-- npm install -g vscode-json-languageserver
2021-07-04 22:14:01 -03:00
require("lspconfig").jsonls.setup {
cmd = {
"node",
DATA_PATH .. "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js",
"--stdio",
},
on_attach = require("lsp").common_on_attach,
2021-03-25 19:58:40 -04:00
2021-07-04 22:14:01 -03:00
commands = {
Format = {
function()
vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 })
end,
},
},
}
2021-06-30 18:45:40 -04:00
if O.lang.json.autoformat then
2021-07-04 22:14:01 -03:00
require("lv-utils").define_augroups {
_json_format = {
{
"BufWritePre",
"*.json",
"lua vim.lsp.buf.formatting_sync(nil, 1000)",
},
},
}
2021-06-30 18:45:40 -04:00
end