From 389f81243903508127131d8c20fd6a222e0fcadc Mon Sep 17 00:00:00 2001 From: Christian Segundo Date: Fri, 12 Jul 2024 12:09:07 +0200 Subject: fix jsonls --- lua/plugins/lang/json.lua | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'lua/plugins/lang') diff --git a/lua/plugins/lang/json.lua b/lua/plugins/lang/json.lua index 1d2d073..0df3a15 100644 --- a/lua/plugins/lang/json.lua +++ b/lua/plugins/lang/json.lua @@ -1,21 +1,27 @@ return { - { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - if type(opts) == "table" then - opts.ensure_installed = opts.ensure_installed or {} - vim.list_extend(opts.ensure_installed, { "json" }) - end - end, - }, + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + if type(opts) == "table" then + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { "json" }) + end + end, + }, - { - "neovim/nvim-lspconfig", - opts = function(_, opts) - if type(opts) == "table" then - opts.servers = opts.servers or {} - opts.servers.jsonls = {} - end - end, - }, + { + "neovim/nvim-lspconfig", + opts = function(_, opts) + if type(opts) == "table" then + opts.servers = opts.servers or {} + opts.servers.jsonls = { + on_attach = function(client, _) + client.server_capabilities.documentFormattingProvider = true + client.server_capabilities.documentRangeFormattingProvider = true + end, + cmd = { "json-language-server", "--stdio" }, + } + end + end, + }, } -- cgit v1.2.3