From cb797dc785de2f18e4c84aaa7940946e26bd6cf5 Mon Sep 17 00:00:00 2001 From: Amaan Q Date: Mon, 9 Jan 2023 19:23:02 -0500 Subject: [PATCH] feat(lang): added extra for c/c++ --- lua/lazyvim/plugins/extras/lang/clangd.lua | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/clangd.lua diff --git a/lua/lazyvim/plugins/extras/lang/clangd.lua b/lua/lazyvim/plugins/extras/lang/clangd.lua new file mode 100644 index 00000000..6fff218a --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/clangd.lua @@ -0,0 +1,58 @@ +return { + + -- add c/c++ to treesitter + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + vim.list_extend(opts.ensure_installed, { "c", "cpp" }) + end, + }, + + -- correctly setup lspconfig + { + "neovim/nvim-lspconfig", + dependencies = { + "p00f/clangd_extensions.nvim", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + }, + }, + opts = { + -- make sure mason installs the server + servers = { + clangd = {}, + }, + setup = { + clangd = function(_, opts) + require("clangd_extensions").setup({ + server = opts, + extensions = { + ast = { + --These require codicons (https://github.com/microsoft/vscode-codicons) + role_icons = { + type = "", + declaration = "", + expression = "", + specifier = "", + statement = "", + ["template argument"] = "", + }, + + kind_icons = { + Compound = "", + Recovery = "", + TranslationUnit = "", + PackExpansion = "", + TemplateTypeParm = "", + TemplateTemplateParm = "", + TemplateParamObject = "", + }, + }, + }, + }) + return true + end, + }, + }, + }, +}