LunarVim/lua/lsp/json-ls.lua

27 lines
682 B
Lua
Raw Normal View History

-- npm install -g vscode-json-languageserver
require'lspconfig'.jsonls.setup {
2021-03-26 00:58:40 +01:00
cmd = {
2021-07-01 00:45:40 +02:00
"node", DATA_PATH ..
"/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js",
2021-03-26 00:58:40 +01:00
"--stdio"
},
on_attach = require'lsp'.common_on_attach,
2021-03-26 00:58:40 +01:00
commands = {
2021-03-26 00:58:40 +01:00
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
require('lv-utils').define_augroups({
_json_format = {
'BufWritePre', '*.json',
'lua vim.lsp.buf.formatting_sync(nil, 1000)'
}
})
end