Skip to content

fix(lsp): add better clangd compile_commands detection#7409

Open
scarf005 wants to merge 3 commits intoanomalyco:devfrom
scarf005:fix/clangd-compile-commands
Open

fix(lsp): add better clangd compile_commands detection#7409
scarf005 wants to merge 3 commits intoanomalyco:devfrom
scarf005:fix/clangd-compile-commands

Conversation

@scarf005
Copy link
Copy Markdown
Contributor

@scarf005 scarf005 commented Jan 9, 2026

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 9, 2026

Hey! Your PR title Fix clangd compile_commands detection doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 9, 2026

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@scarf005 scarf005 changed the title Fix clangd compile_commands detection fix: add better clangd compile_commands detection Jan 9, 2026
@scarf005 scarf005 changed the title fix: add better clangd compile_commands detection feat: add better clangd compile_commands detection Jan 9, 2026
@scarf005 scarf005 marked this pull request as ready for review January 9, 2026 02:18
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 9, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@scarf005 scarf005 changed the title feat: add better clangd compile_commands detection fix(lsp): add better clangd compile_commands detection Jan 9, 2026
@fwang fwang requested a review from adamdotdevin as a code owner January 9, 2026 06:32
@scarf005 scarf005 force-pushed the fix/clangd-compile-commands branch from 4b8bc43 to 56511a8 Compare January 9, 2026 16:34
@scarf005 scarf005 force-pushed the fix/clangd-compile-commands branch from 56511a8 to 6902e6c Compare January 20, 2026 00:16
@thdxr thdxr force-pushed the dev branch 3 times, most recently from f1ae801 to 08fa7f7 Compare January 30, 2026 14:37
@scarf005 scarf005 force-pushed the fix/clangd-compile-commands branch from 6902e6c to 453e8d5 Compare February 6, 2026 01:59
@scarf005 scarf005 force-pushed the fix/clangd-compile-commands branch from 453e8d5 to c840a65 Compare February 15, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clangd LSP always fails

1 participant