[cfe-dev] clangd, completion in header files

Manuel Klimek via cfe-dev cfe-dev at lists.llvm.org
Mon Mar 26 00:56:46 PDT 2018


+Sam and Ilya

On Mon, Mar 26, 2018 at 4:04 AM Jan Včelák via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hello list,
>
> thank you for all the work on clangd. I tried it for the first time
> with VSCode and I'm really impressed how useful it is just out of the
> box.
>
> I however encountered a problem with code completion in header files
> and I would like to know if it's a bug in clangd or a problem in my
> setup. I work on a C++ project which has headers with .h extension and
> clangd incorrectly assumes it's a C code because it emits (besides
> other things) "unknown type name 'namespace'" diagnostics message for
> the namespace definition.
>
> I run clangd -input-mirror-file for a while and I can see
> textDocument/didOpen calls for the .h headers with "languageId" set to
> "cpp". If I rename a header to .hpp, the problem disappears. I also
> tried configuring custom file extension association for C++ in VSCode
> and it worked as well. So I believe there must be something wrong just
> with .h (i.e. clangd seems not to respect languageId for .h files).
>
> Please, can you guide me how to diagnose the problem better so I can
> eventually fill a bug report?
>
> I also wonder how the completion is supposed to work in headers in
> general. Is there some heuristics to guess the compilation flags
> because the headers are not in the compilation database (at least when
> generated by cmake)?
>
> Regards,
>
> Jan
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180326/43b28697/attachment.html>


More information about the cfe-dev mailing list