summaryrefslogtreecommitdiffstats
path: root/after/lsp/clangd.lua
blob: b1919c8fe108f740b87b21b7c4e1e37dc5344622 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
local map = require("core.misc").map

return {
  on_attach = function(_, bufnr)
    -- add some clangd specific mappings
    local opts = { buffer = bufnr }
    map("n", "<leader>o", "<cmd>ClangdSwitchSourceHeader<CR>", opts)
  end,

  cmd = {
    "clangd",
    "--background-index",
    "--clang-tidy",
    "--header-insertion=iwyu",
    "--completion-style=detailed",
    "--function-arg-placeholders",
    "--fallback-style=llvm"
  },

  init_options = {
    usePlaceholders = true,
    clangdFileStatus = true,
    fallback_flags = {
      "-xc" -- makes clangd think we"re using c instead of c++
    }
  }
}