adding lsp server options pt 10
This commit is contained in:
parent
7ae4827388
commit
75f313b260
|
@ -49,27 +49,25 @@ return {
|
||||||
},
|
},
|
||||||
clangd = {
|
clangd = {
|
||||||
cmd = (function()
|
cmd = (function()
|
||||||
if nix_paths.clang_driver_path and nix_paths.macos_sdk_path and nix_paths.libcxx_include_path then
|
if nix_paths.clang_driver_path then
|
||||||
return {
|
return {
|
||||||
'clangd',
|
'clangd',
|
||||||
'--query-driver=' .. nix_paths.clang_driver_path,
|
'--query-driver=' .. nix_paths.clang_driver_path,
|
||||||
-- Explicitly pass system root and C++ standard library include path as clangd arguments.
|
-- No other compiler flags like -isysroot or -isystem should be passed directly here.
|
||||||
-- These are compiler flags that clangd can use to understand the environment.
|
-- Clangd gets those from compile_commands.json or by querying the driver.
|
||||||
'--compile-commands-dir='
|
'--compile-commands-dir='
|
||||||
.. vim.fn.getcwd()
|
.. vim.fn.getcwd()
|
||||||
.. '/build', -- Assuming compile_commands.json is in <project_root>/build
|
.. '/build', -- Ensure clangd finds compile_commands.json
|
||||||
'-extra-arg=-isysroot=' .. nix_paths.macos_sdk_path,
|
|
||||||
'-extra-arg=-isystem=' .. nix_paths.libcxx_include_path,
|
|
||||||
-- You could also try adding the resource-dir from compile_commands.json if needed:
|
|
||||||
-- "-extra-arg=-resource-dir=/nix/store/YOUR_CLANG_RESOURCE_DIR_HASH/lib/clang/VERSION"
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
vim.notify('Warning: One or more Nix paths for clangd (driver, sdk, libcxx) not defined. Clangd might have issues.', vim.log.levels.WARN)
|
vim.notify(
|
||||||
|
'Warning: Nix path for clang_driver_path not defined in custom.nix_paths.lua. Clangd might use system clangd or have issues.',
|
||||||
|
vim.log.levels.WARN
|
||||||
|
)
|
||||||
return { 'clangd' } -- Fallback
|
return { 'clangd' } -- Fallback
|
||||||
end
|
end
|
||||||
end)(),
|
end)(),
|
||||||
-- Ensure clangd knows the project root to find compile_commands.json and .clangd
|
root_dir = require('lspconfig.util').root_pattern('compile_commands.json', '.git'), -- Helps find project root
|
||||||
root_dir = require('lspconfig.util').root_pattern('compile_commands.json', '.git', '.clangd'),
|
|
||||||
},
|
},
|
||||||
pyright = {
|
pyright = {
|
||||||
settings = {
|
settings = {
|
||||||
|
|
Loading…
Reference in New Issue