opencode
opencode copied to clipboard
fix(lsp): add better clangd compile_commands detection
Problem
clangd sometimes reports bogus STL include errors (e.g. <string> not found) even when a project provides a CMake-generated compile_commands.json (often via a symlink).
Fix
- Make LSP root discovery search up to the git top-level (Instance.worktree), so
compile_commands.jsoncan be found even if opencode is started from a subdirectory. - Start clangd with
--query-driver(covers common compiler wrappers likeccache/sccache) so clangd can discover system include paths reliably. - If
compile_commands.jsonexists at the chosen root, pass--compile-commands-direxplicitly.