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