Added clangd_extensions

This commit is contained in:
Oliver Hartmann 2022-03-16 23:55:26 +01:00
parent d219e43cc7
commit e3a6774b76
3 changed files with 25 additions and 2 deletions

View File

@ -109,7 +109,10 @@ return require('packer').startup(function()
use({ 's1n7ax/nvim-terminal' }) use({ 's1n7ax/nvim-terminal' })
use({ use({
'williamboman/nvim-lsp-installer', 'williamboman/nvim-lsp-installer',
requires = { 'neovim/nvim-lspconfig' }, requires = {
'neovim/nvim-lspconfig',
'/p00f/clangd_extensions.nvim',
},
config = get_setup('lspinstall'), config = get_setup('lspinstall'),
}) })
use({ use({

View File

@ -83,6 +83,18 @@ cmp.setup({
{ name = 'emoji' }, { name = 'emoji' },
}, },
completion = { completeopt = 'menu,menuone,noinsert, noselect' }, completion = { completeopt = 'menu,menuone,noinsert, noselect' },
sorting = {
comparators = {
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.recently_used,
require("clangd_extensions.cmp_scores"),
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
},
-- experimental = { native_menu = true } -- experimental = { native_menu = true }
}) })

View File

@ -116,7 +116,7 @@ lsp_installer.on_server_ready(function(server)
-- (optional) Customize the options passed to the server -- (optional) Customize the options passed to the server
if server.name == 'clangd' then if server.name == 'clangd' then
opts.cmd = { 'clangd', '--compile-commands-dir=build_nvim' } return
end end
-- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart) -- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart)
@ -139,3 +139,11 @@ null_ls.setup({
capabilities = capabilities, capabilities = capabilities,
}) })
vim.diagnostic.config({ virtual_text = false }) vim.diagnostic.config({ virtual_text = false })
require('clangd_extensions').setup({
server = {
on_attach = on_attach,
capabilities = capabilities,
cmd = { 'clangd', '--compile-commands-dir=build_nvim' }
},
})