LunarVim/ftplugin/json.lua

30 lines
645 B
Lua
Raw Normal View History

-- npm install -g vscode-json-languageserver
2021-07-05 03:14:01 +02: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-26 00:58:40 +01:00
2021-07-05 03:14:01 +02:00
commands = {
Format = {
function()
vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 })
end,
},
},
}
2021-07-01 00:45:40 +02:00
if O.lang.json.autoformat then
2021-07-05 03:14:01 +02:00
require("lv-utils").define_augroups {
_json_format = {
{
"BufWritePre",
"*.json",
"lua vim.lsp.buf.formatting_sync(nil, 1000)",
},
},
}
2021-07-01 00:45:40 +02:00
end