[PR #7409] fix(lsp): add better clangd compile_commands detection #12393

Open
opened 2026-02-16 18:17:18 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/7409

State: open
Merged: No


fix #9521

Fix

  • Make LSP root discovery search up to the git top-level (Instance.worktree), so compile_commands.json can be found even if opencode is started from a subdirectory.
  • Start clangd with --query-driver (covers common compiler wrappers like ccache/sccache) so clangd can discover system include paths reliably.
  • If compile_commands.json exists at the chosen root, pass --compile-commands-dir explicitly.
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7409 **State:** open **Merged:** No --- fix #9521 ### Fix - Make LSP root discovery search up to the git top-level (Instance.worktree), so `compile_commands.json` can be found even if opencode is started from a subdirectory. - Start clangd with `--query-driver` (covers common compiler wrappers like `ccache`/`sccache`) so clangd can discover system include paths reliably. - If `compile_commands.json` exists at the chosen root, pass `--compile-commands-dir` explicitly.
yindo added the pull-request label 2026-02-16 18:17:18 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12393