【发布时间】:2022-07-05 11:43:01
【问题描述】:
我在配置我的 neovim lsp 时遇到了一个问题。我的 lsp 客户端是 nvim-lspconfig,而 clangd 是我的 lsp 服务器。 这是我的 clangd 设置参数
require('lspconfig')['clangd'].setup {
on_attach = on_attach,
flags = {
-- This will be the default in neovim 0.7+
debounce_text_changes = 150,
},
capabilities = capabilities,
cmd = {
'clangd',
'--background-index',
'--query-driver="/app/vbuild/RHEL7-x86_64/clang/latest/bin/clang, \
/app/vbuild/RHEL7-x86_64/clang/latest/bin/clang++, \
/app/vbuild/RHEL7-x86_64/gcc/latest/bin/gcc, \
/app/vbuild/RHEL7-x86_64/gcc/latest/bin/g++"',
'--clang-tidy',
'--all-scopes-completion',
'--cross-file-rename',
'--completion-style=detailed',
'--header-insertion-decorators',
'--header-insertion=iwyu',
'--pch-storage=memory',
'--enable-config',
'--log=verbose'
},
filetypes = {"c", "cpp", "objc", "objcpp"}
}
我的g++和clangd版本如下
g++ (GCC) 10.3.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
clangd version 14.0.0
Features: linux
Platform: x86_64-unknown-linux-gnu
同时,我将以下包含路径添加到我的 CPATH 中
setenv CPATH "/app/vbuild/RHEL7-x86_64/gcc/latest/include/c++/10.3.0:/app/vbuild/RHEL7-x86_64/glibc/2.33/include"
setenv CPATH "/app/vbuild/RHEL7-x86_64/clang/latest/include/clang-c:/app/vbuild/RHEL7-x86_64/clang/latest/include/llvm-c:$CPATH"
但我仍然在我的 neovim 中发现了这些错误
clangd 似乎找不到相关的 stl 标头。但我在 $CPATH 中检查了我的包含路径。它确实有 stl 标头。有谁知道如何解决这个问题? 谢谢
【问题讨论】: