From dc8e5126c2ed8d5363039ce0ca5860fdf10d3089 Mon Sep 17 00:00:00 2001 From: Sean Buckley Date: Sat, 2 Mar 2024 00:39:29 -0500 Subject: [PATCH] vim: refactor noFormat --- pkgs/bck-nvim/lua/5-lsp.lua | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/pkgs/bck-nvim/lua/5-lsp.lua b/pkgs/bck-nvim/lua/5-lsp.lua index 0048e77..678427a 100644 --- a/pkgs/bck-nvim/lua/5-lsp.lua +++ b/pkgs/bck-nvim/lua/5-lsp.lua @@ -1,5 +1,8 @@ local lspconfig = require('lspconfig') local capabilities = require('cmp_nvim_lsp').default_capabilities() +local noFormat = function(client, _) + client.server_capabilities.documentFormattingProvider = false +end ---------------------------------------------------------------- lspconfig.lua_ls.setup({ @@ -21,25 +24,19 @@ lspconfig.pyright.setup({ ---------------------------------------------------------------- lspconfig.tsserver.setup({ capabilities = capabilities, - on_attach = function(client, _) - client.server_capabilities.documentFormattingProvider = false - end, + on_attach = noFormat, }) ---------------------------------------------------------------- lspconfig.html.setup({ capabilities = capabilities, - on_attach = function(client, _) - client.server_capabilities.documentFormattingProvider = false - end, + on_attach = noFormat, }) ---------------------------------------------------------------- lspconfig.cssls.setup({ capabilities = capabilities, - on_attach = function(client, _) - client.server_capabilities.documentFormattingProvider = false - end, + on_attach = noFormat, }) ---------------------------------------------------------------- @@ -58,9 +55,7 @@ lspconfig.nil_ls.setup({ ---------------------------------------------------------------- lspconfig.jsonls.setup({ capabilities = capabilities, - on_attach = function(client, _) - client.server_capabilities.documentFormattingProvider = false - end, + on_attach = noFormat, }) ----------------------------------------------------------------