<div dir="ltr">Hi,<div><br></div><div>I recently tried to use clangd for Chromium in vscode and hit the same issue. </div><div>I experimented a bit with generating a compile_commands.json file with valid rules for headers and came to this solution: <a href="https://gist.github.com/xchrdw/bfd2b3a5f765f4195a55d6351daf1b48">https://gist.github.com/xchrdw/bfd2b3a5f765f4195a55d6351daf1b48</a></div><div>I sorted all .cc filenames and then looked up the index of the closest match<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span> </span>for each header </span>using binary search. As there were some edge cases like the first or last file in a directory, I additionally compared which file at the index has the largest prefix with the header.</div><div>I found a few issues with system headers and some generated protobuf headers but otherwise it works well.</div><div>Native support from clangd would be amazing :)</div><div><br></div><div>Thanks,</div><div>Christian</div></div>