Skip to content
Discussion options

You must be logged in to vote

https://github.com/neovim/nvim-lspconfig/blob/ead0f5f342d8d323441e7d4b88f0fc436a81ad5f/lsp/clangd.lua#L95

ahahaha that is why

nvim-lspconfig sets on_attach for clangd themselves.

This overrides things provided by "*"

To work around this slightly cleaner than you were doing, instead of

  {
    "clangd",
    for_cat = "cpp",
    before = function(_)
      vim.lsp.config('clangd', {
        on_attach = my_lsp_on_attach,
      })
    end,

    lsp = {
      filetypes = { "c", "cpp" },
      settings = {
        clangd = {
          shit = ""
        },
      },
    },
  },

do

  {
    "clangd",
    for_cat = "cpp",
    lsp = {
      filetypes = { "c", "cpp" },
      on_attach = my_lsp_on_attach,…

Replies: 5 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@BirdeeHub
Comment options

Answer selected by BirdeeHub
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@BirdeeHub
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #308 on February 27, 2026 23:20.