Open Hedgefog opened 4 months ago
Clangd expects to get information about include paths from a compile_commands.json
file, as described at https://clangd.llvm.org/installation#project-setup.
This file is intended to be generated by the build system, and should reflect the same commands used to actually compile the files.
The idea behind this approach is that information about the project's include paths, is only specified in one place: wherever the build system gets it from (often a metadata file like CMakeLists.txt
). The build system then uses the same information both for the actual build, and for generating the compile_commands.json
file which clangd then uses. If you make a modification such as adding a new include path, you only have to make it in one place (e.g. in CMakeLists.txt
); it's not necessary to make the update in a second place which is specific to the editor.
Hi there,
I've recently started using
clangd
and noticed a lack of support for glob patterns in include paths. This feature is crucial for projects with large libraries and frameworks that have complex nested directory structures.Currently, the C++ Language Server uses the
c_cpp_properties.json
file, which supportsglob
patterns and vscodevariables
. Here is an example configuration:env
section allows set environment variables used during compilation.config:*
- variables reference settings from the settings.json file.env:*
- environment variables (can be defined within theenv
section)VSCode Glob Pattern References: https://code.visualstudio.com/docs/editor/glob-patterns https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options
I think integrating support for glob patterns and variables would greatly enhance its utility for large projects.