<div dir="ltr">+Sam and Ilya<br><br><div class="gmail_quote"><div dir="ltr">On Mon, Mar 26, 2018 at 4:04 AM Jan Včelák via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello list,<br>
<br>
thank you for all the work on clangd. I tried it for the first time<br>
with VSCode and I'm really impressed how useful it is just out of the<br>
box.<br>
<br>
I however encountered a problem with code completion in header files<br>
and I would like to know if it's a bug in clangd or a problem in my<br>
setup. I work on a C++ project which has headers with .h extension and<br>
clangd incorrectly assumes it's a C code because it emits (besides<br>
other things) "unknown type name 'namespace'" diagnostics message for<br>
the namespace definition.<br>
<br>
I run clangd -input-mirror-file for a while and I can see<br>
textDocument/didOpen calls for the .h headers with "languageId" set to<br>
"cpp". If I rename a header to .hpp, the problem disappears. I also<br>
tried configuring custom file extension association for C++ in VSCode<br>
and it worked as well. So I believe there must be something wrong just<br>
with .h (i.e. clangd seems not to respect languageId for .h files).<br>
<br>
Please, can you guide me how to diagnose the problem better so I can<br>
eventually fill a bug report?<br>
<br>
I also wonder how the completion is supposed to work in headers in<br>
general. Is there some heuristics to guess the compilation flags<br>
because the headers are not in the compilation database (at least when<br>
generated by cmake)?<br>
<br>
Regards,<br>
<br>
Jan<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div>