From 9f511bcb594b7e2461c97cb8182603928c773c2f Mon Sep 17 00:00:00 2001 From: Rafael Date: Sun, 4 Jul 2021 22:14:01 -0300 Subject: start formatting rules --- ftplugin/json.lua | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'ftplugin/json.lua') diff --git a/ftplugin/json.lua b/ftplugin/json.lua index 3a565095..da0c9ff2 100644 --- a/ftplugin/json.lua +++ b/ftplugin/json.lua @@ -1,28 +1,29 @@ -- 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", - "--stdio" - }, - on_attach = require'lsp'.common_on_attach, +require("lspconfig").jsonls.setup { + cmd = { + "node", + DATA_PATH .. "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js", + "--stdio", + }, + on_attach = require("lsp").common_on_attach, - commands = { - Format = { - function() - vim.lsp.buf.range_formatting({}, {0, 0}, {vim.fn.line("$"), 0}) - end - } - } + commands = { + Format = { + function() + vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 }) + end, + }, + }, } if O.lang.json.autoformat then - require('lv-utils').define_augroups({ - _json_format = { - { - 'BufWritePre', '*.json', - 'lua vim.lsp.buf.formatting_sync(nil, 1000)' - } - } - }) + require("lv-utils").define_augroups { + _json_format = { + { + "BufWritePre", + "*.json", + "lua vim.lsp.buf.formatting_sync(nil, 1000)", + }, + }, + } end -- cgit v1.2.3 From 71c5cb4f0be89d3a175e99b0c2ebc5e55178e8a9 Mon Sep 17 00:00:00 2001 From: Rafael Date: Mon, 5 Jul 2021 20:01:19 +0000 Subject: (feat) use neoformat as the defalt format option (#715) --- ftplugin/json.lua | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'ftplugin/json.lua') diff --git a/ftplugin/json.lua b/ftplugin/json.lua index da0c9ff2..29a3096f 100644 --- a/ftplugin/json.lua +++ b/ftplugin/json.lua @@ -15,15 +15,3 @@ 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