diff options
Diffstat (limited to 'lua/lsp/json-ls.lua')
-rw-r--r-- | lua/lsp/json-ls.lua | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lua/lsp/json-ls.lua b/lua/lsp/json-ls.lua index 952673ac..7d3c3716 100644 --- a/lua/lsp/json-ls.lua +++ b/lua/lsp/json-ls.lua @@ -1,7 +1,8 @@ -- npm install -g vscode-json-languageserver require'lspconfig'.jsonls.setup { cmd = { - "node", DATA_PATH .. "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js", + "node", DATA_PATH .. + "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js", "--stdio" }, on_attach = require'lsp'.common_on_attach, @@ -14,3 +15,12 @@ require'lspconfig'.jsonls.setup { } } } + +if O.lang.json.autoformat then + require('lv-utils').define_augroups({ + _json_format = { + 'BufWritePre', '*.json', + 'lua vim.lsp.buf.formatting_sync(nil, 1000)' + } + }) +end |