This project is a fork of clangd with patches to add support for outputting LSIF indexes. Specifically, a fork of the clang-tools-extra/clangd
subdirectory of the llvm-project repo.
This project has only been tested extensively on C++ projects and C projects, but Objective C projects should both be supported as well following the same instructions.
If you can't get lsif-clang
working with your project, first file an issue! We want this to work everywhere.
But the C++ ecosystem is fragmented, and it's possible that your project simply won't play nice with the clang
toolchain.
lsif-cpp is also available, which acts as a plugin for arbitrary C++ compilers and might therefore be compatible.
Unfortunately, it has several major defects compared to lsif-clang
(it is much slower and does not provide hovers), and is not the recommended option.
Follow the installation instructions to get the tool set up, then the compilation database instructions to generate a compilation database. Then run
lsif-clang compile_commands.json
If you get missing header warnings (common on MacOS), you can try
lsif-clang --extra-arg="-resource-dir=$(clang -print-resource-dir)" compile_commands.json
If you are still missing headers, there's likely an error in the way the compilation database was set up, or some generated code that's necessary for c++ compilation hasn't been output yet.
See the examples of producing LSIF indexes for a variety of OSS repositories to help troubleshoot.
You can use the lsif-validate tool for basic sanity checking, or upload the index to a Sourcegraph instance to see the hovers, definitions, and references in action.