diff options
author | christianchiarulli <[email protected]> | 2021-06-30 18:45:40 -0400 |
---|---|---|
committer | christianchiarulli <[email protected]> | 2021-06-30 18:45:40 -0400 |
commit | 9e7ad6074746a3f7d60e164be919b53ad17a33dd (patch) | |
tree | 6ccd7982f850908d317945fd8967119b298c4ffb /lua/lsp/json-ls.lua | |
parent | d8cf871a389d9900fa21077870a817cdb6a6b47b (diff) |
refactor autocommands
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 |