Update lsp to new api

This updates from the old lspconfig plugins to the new lua lsp api and
removes my old ccls config.
This commit is contained in:
2025-10-27 19:12:18 +01:00
parent de9ad7fb55
commit ffeed26423
+6 -33
View File
@@ -45,38 +45,11 @@ cmp.setup.cmdline(':', {
matching = { disallow_symbol_nonprefix_matching = false }
})
-- Set up lspconfig.
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local lsp = require('lspconfig')
-- lsp.ccls.setup{
-- capabilities = capabilities,
-- init_options = {
-- cache = {
-- directory = vim.fn.expand("~/.cache/ccls") -- Store index globally
-- },
-- compilationDatabaseDirectory = "build", -- Uses 'build/compile_commands.json' if present
-- highlight = { lsRanges = true }, -- Improves semantic highlighting
-- index = {
-- threads = 4, -- Adjust based on your CPU (more threads = faster indexing)
-- initialBlacklist = { ".*_test.cpp", ".*_unittest.cpp" }
-- -- initialBlacklist = { ".*_test.cpp", ".*_unittest.cpp", "/home/furtest/linux_bidouille/.*" } -- Avoid indexing test files
-- },
-- completion = {
-- detailedLabel = true -- Better completion info
-- },
-- diagnostics = {
-- onChange = 300 -- Delay diagnostics updates for better performance
-- }
-- }
-- }
-- clangd and ccls are both C and C++ language servers
-- having them both active at the same time is useless
lsp.clangd.setup {
capabilities = capabilities,
cmd = { "clangd", "--enable-config" },
vim.lsp.config.clangd = {
cmd = { 'clangd', '--background-index' },
root_markers = { 'compile_commands.json', 'compile_flags.txt', '.clangd' },
filetypes = { 'c', 'cpp' },
}
vim.lsp.enable({'clangd'})