From 9e7ad6074746a3f7d60e164be919b53ad17a33dd Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Wed, 30 Jun 2021 18:45:40 -0400 Subject: refactor autocommands --- lua/lsp/json-ls.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lua/lsp/json-ls.lua') 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 -- cgit v1.2.3