[FEATURE] `--compile-commands-dir=` for clangd-lsp

Resolved 💬 2 comments Opened Mar 5, 2026 by ObiWahn Closed Apr 3, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

I use frequently different build directories with the same source directory. Since claude looks into the source dir (for a symlink from the build dir) or reads the .clangd file one of them has to change constantly.

Proposed Solution

It would be good to have the option to point claude to the compile_commands.json that should be used. cmake creates this file anyway in the build directory. I think the sanest default is to look into the build dir first, and then into the source.

Alternative Solutions

It would even be better if that was configurable, but source first should be in 99% of all cases what people want / expect.

Priority

High - Significant impact on productivity

Feature Category

Configuration and settings

Use Case Example

  1. I configure my project in one way: build_dir= ${pwd}-build/debug/ (all code including tests)
  2. I configure my project in one way: build_dir= ${pwd}-build/release/ (no add_subdirectories called for tests)
  3. build both (one build one configuration builds 20 min)
  4. Now when i work with vim in the source I tell vim which compile_command.json to use. But I need to change files in my source directory for claude to pick the correct file.
  5. This is tooling that should not require any change in the source.

Additional Context

_No response_

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗