Setting clangd capabilities #354
-
Hello, I've recently migrated from my old LSP setup to -- Customize capabilities for clangd server
if server == "clangd" then
server_capabilities.offsetEncoding = "utf-8"
end For context: -- Set up Mason
require("mason").setup()
-- Configure Mason LSP
require("mason-lspconfig").setup({
ensure_installed = vim.tbl_keys(servers),
handlers = {
function(server)
-- Create a deep copy of capabilities
local server_capabilities = vim.deepcopy(capabilities)
-- Customize capabilities for clangd server
if server == "clangd" then
server_capabilities.offsetEncoding = "utf-8"
end
-- Set up LSP configurations for the current server
require("lspconfig")[server].setup({
capabilities = server_capabilities,
on_attach = on_attach,
settings = servers[server],
filetypes = (servers[server] or {}).filetypes,
})
end,
},
}) I've also scanned through the docs, and it only shows how to configure the default capabilities for all servers. How can I change the capabilities only for P.S. I also came across a discussion where |
Beta Was this translation helpful? Give feedback.
Answered by
VonHeikemen
Dec 5, 2023
Replies: 1 comment 5 replies
-
If I understand correctly, you can add a new handler for require('mason').setup({})
require('mason-lspconfig').setup({
handlers = {
lsp_zero.default_setup,
clangd = function()
require('lspconfig').clangd.setup({
capabilities = {
offsetEncoding = 'utf-8',
},
})
end,
},
}) |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If I understand correctly, you can add a new handler for
clangd
and just setup the language server there.