json.lua 500 B

123456789101112131415161718192021
  1. if require("lv-utils").check_lsp_client_active "jsonls" then
  2. return
  3. end
  4. -- npm install -g vscode-json-languageserver
  5. require("lspconfig").jsonls.setup {
  6. cmd = {
  7. "node",
  8. DATA_PATH .. "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js",
  9. "--stdio",
  10. },
  11. on_attach = require("lsp").common_on_attach,
  12. commands = {
  13. Format = {
  14. function()
  15. vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 })
  16. end,
  17. },
  18. },
  19. }