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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
return {
"neovim/nvim-lspconfig",
dependencies = {
"williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim"
},
config = function()
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = {"cmake", "lua_ls"}
})
vim.lsp.config["clangd"] = {
cmd = {
"clangd", "--background-index", "--clang-tidy",
"--header-insertion=iwyu", "--completion-style=detailed",
"--function-arg-placeholders", "--fallback-style=llvm"
},
root_markers = {
{
"CMakeLists.txt", "Makefile", "configure.ac",
"configure.in", "config.h.in", "meson.build",
"meson_options.txt", "build.ninja"
}, {"compile_commands.json", "compile_flags.txt"}, {".git"}
},
filetypes = {"cpp", "hpp", "c", "h"},
capabilities = {
offsetEncoding = {"utf-16"},
textDocument = {
semanticTokens = {multilineTokenSupport = true},
completion = {completionItem = {snippetSupport = true}}
}
},
init_options = {
usePlaceholders = true,
completeUnimported = true,
clangdFileStatus = true
}
}
vim.diagnostic.config({virtual_text = true})
vim.keymap.set("n", "<leader>o", "<cmd>LspClangdSwitchSourceHeader<cr>")
vim.lsp.config["cmake"] = {}
vim.lsp.config["lua_ls"] = {
settings = {completion = {callSnippet = 'Replace'}}
}
vim.lsp.enable("clangd")
vim.lsp.enable("cmake")
vim.lsp.enable("lua_ls")
end
}
|