<div dir="ltr">Hi Mikael,<div><br></div><div>I guess you should also fix "command" part in order to make clangd work with fine. So apart from fixing "file" you should replace *_package.cpp and *package.cpp.o entries in the "command" arguments with needed .cpp file paths. Just checked it, with improper "command" with clangd + emacs + lsp on macos I have no code completion.</div></div><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 28 May 2019 at 11:00, Mikael Springer via clangd-dev <<a href="mailto:clangd-dev@lists.llvm.org" target="_blank">clangd-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Hi.<br>
<br>
We have our code structured in a somewhat unusual way. All *.cpp source files are included (#include …) in a number of *_package.cpp files. These *_package.cpp files are the ones configured in a Xcode project and in a Visual Studio project. The primary reason for this organization is to minimise the need to update Xcode and Visual Studio projects when adding new source files to the project (one just includes the new file in a suitable *_package.cpp file which is already a part of the project).<br>
<br>
A consequence of this is that only the *_package.cpp files are visible in the compilation output. When we generate a compile_commands.json (using xcpretty since I’m on MacOS and using Xcode) this compilation database only contains entries for the *_package.cpp files. If I want to use for example Emacs and LSP this doesn’t work since a large part of the code base is not in the compilation database.<br>
<br>
Would it be possible to add entries for each cpp source file that is included in the *_package.cpp files to the compile_commands.json (using a script). Would Clangd be able to parse this correctly? The idea is to copy the corresponding *_package.cpp entry in which the source file is included and alter the “file” part of the entry to refer to the source file instead, but leave the “command” part intact. This makes sense in a way since this is the way the source file is compiled even if it doesn’t show. Can Clangd work with this input?<br>
<br>
Regards, Micke.<br>
<br>
_______________________________________________<br>
clangd-dev mailing list<br>
<a href="mailto:clangd-dev@lists.llvm.org" target="_blank">clangd-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev</a><br>
</blockquote></div>