clangd-query
Version:
Fast C++ code intelligence CLI tool for humans and AI agents. Provides semantic search, source code reading and usage lookups.
21 lines • 1.14 kB
TypeScript
/**
* Ensures a compile_commands.json exists in the .cache/clangd-query directory.
*
* This function follows the startup logic from the technical specification:
* 1. First checks if compile_commands.json already exists in .cache/clangd-query/build
* 2. If not, checks if CMakeLists.txt exists in the project root
* 3. If CMakeLists.txt exists, runs CMake to generate compile_commands.json
* 4. All generated files are kept within .cache/clangd-query to avoid interfering with
* the user's build setup or other tools like VSCode's clangd
*
* The compile_commands.json file is essential for clangd to understand how to
* compile each source file in the project, enabling accurate code analysis,
* navigation, and symbol indexing.
*
* @param projectRoot - The absolute path to the C++ project root directory
* @returns The path to the directory containing compile_commands.json
* @throws Error if no CMakeLists.txt is found or if CMake fails to generate
* the compilation database
*/
export declare function ensureCompileCommands(projectRoot: string): Promise<string>;
//# sourceMappingURL=compilation-db.d.ts.map