aboutsummaryrefslogtreecommitdiffstats
path: root/lua/pi/lsp/servers/clangd.lua
blob: 3c4ac958da6c067c7d44a066c96ceb4f465c8bef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
local lsp_attach = require "pi.lsp.attach"
local lsp_flags = require "pi.lsp.flags"

return function(ops)
  local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities())
  local config = {
    on_attach = lsp_attach,
    flags = lsp_flags,
    filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto" },
    capabilities = vim.tbl_deep_extend("force", capabilities, {
      offsetEncoding = { "utf-16" },
      general = {
        positionEncodings = { "utf-16" },
      },
    }),
  }
  if vim.fn.executable "clangd" == 1 then
    config.cmd = { "clangd" }
  end

  return vim.tbl_extend("force", config, ops)
end