You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.2 KiB
Lua
51 lines
1.2 KiB
Lua
local decode_json_file = function(filename)
|
|
if vim.fn.filereadable(filename) == 0 then
|
|
return nil
|
|
end
|
|
|
|
return vim.fn.json_decode(vim.fn.readfile(filename))
|
|
end
|
|
|
|
local opts = {
|
|
before_init = function(_, config)
|
|
-- local util = require("lspconfig/util")
|
|
-- local path = util.path
|
|
--
|
|
-- local dot_clangd = path.join(vim.fn.getcwd(), ".pclangd")
|
|
-- local tbl = decode_json_file(dot_clangd)
|
|
--
|
|
-- -- Example .pclangd config
|
|
-- -- {
|
|
-- -- "clangd_args":
|
|
-- -- {
|
|
-- -- "toolchain": "gcc",
|
|
-- -- "build_dir": "build"
|
|
-- -- },
|
|
-- -- "dap_args":
|
|
-- -- {
|
|
-- -- "program_name": "udp_server",
|
|
-- -- "args": ["10010"],
|
|
-- -- "build_dir": "build"
|
|
-- -- }
|
|
-- --
|
|
-- -- }
|
|
--
|
|
-- local clangd_args = tbl["clangd_args"]
|
|
-- local toolchain = clangd_args.toolchain
|
|
-- local build_dir = clangd_args.build_dir
|
|
--
|
|
-- config.root_dir = util.root_pattern(".pclangd")
|
|
-- -- vim.api.nvim_err_writeln(config.root_dir)
|
|
-- config.cmd = { "clangd",
|
|
-- "--query-driver=" .. toolchain,
|
|
-- "--compile-commands-dir=" .. path.join(vim.fn.getcwd(), build_dir),
|
|
-- "--pch-storage=memory",
|
|
-- "--background-index",
|
|
-- "-j=4",
|
|
-- "--header-insertion-decorators=0",
|
|
-- "--log=verbose"
|
|
-- }
|
|
end,
|
|
}
|
|
return opts
|