From dd4d5b842c7d18537d9dad244507570adf032c7a Mon Sep 17 00:00:00 2001 From: Mo8it Date: Thu, 28 Apr 2022 04:01:30 +0200 Subject: [PATCH] Add clangd --- .config/nvim/lua/plugins/lsp-cmp.lua | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.config/nvim/lua/plugins/lsp-cmp.lua b/.config/nvim/lua/plugins/lsp-cmp.lua index 1383296..29e8373 100644 --- a/.config/nvim/lua/plugins/lsp-cmp.lua +++ b/.config/nvim/lua/plugins/lsp-cmp.lua @@ -17,10 +17,12 @@ local function format_on_save(client) end end +local lsp_signature = require("lsp_signature") + lspconfig["pylsp"].setup({ capabilities = capabilities, on_attach = function(client, bufnr) - require("lsp_signature").on_attach() + lsp_signature.on_attach() -- Disable formatting client.resolved_capabilities.document_formatting = false @@ -28,16 +30,23 @@ lspconfig["pylsp"].setup({ end, }) +local function on_attach_with_formatting(client, bufnr) + lsp_signature.on_attach() + format_on_save(client) +end + lspconfig["julials"].setup({ capabilities = capabilities, - on_attach = function(client, bufnr) - require("lsp_signature").on_attach() - format_on_save(client) - end, + on_attach = on_attach_with_formatting, +}) + +lspconfig["clangd"].setup({ + capabilities = capabilities, + on_attach = on_attach_with_formatting, }) -- null-ls -null_ls = require("null-ls") +local null_ls = require("null-ls") null_ls.setup({ sources = { @@ -49,8 +58,6 @@ null_ls.setup({ null_ls.builtins.formatting.shellharden, null_ls.builtins.formatting.shfmt, null_ls.builtins.formatting.taplo, - -- cpp - null_ls.builtins.formatting.clang_format, }, on_attach = format_on_save, })