<div dir="ltr">Sorry about that :-( <a class="gmail_plusreply" id="plusReplyChip-0" href="mailto:ioeric@google.com" tabindex="-1">+Eric Liu</a> who may have thoughts.<div>I don't think we have an option to disable includes today, maybe we should add one...</div><div><br></div><div>But we don't expect the inserted includes to create compile errors - <b>this is probably a bug, it'd be great if you could provide more details</b> (is it the right header but spelled wrong, or the wrong header entirely, etc). It may be that you'd like this feature if it worked properly.</div><div><br></div><div>---</div><div><br></div><div>For turning this off, there are a few cases to consider.</div><div>Completions come from the current AST and clangd's index, header insertions always comes from clangd's index.</div><div>A) the suggestion comes from the AST, not the index<br></div><div>B) the suggestion comes from both the AST and the index, and the suggested header is already directly included</div><div>C) the suggestion comes from both the AST and the index, and the suggested header is not directly included</div><div>D) the suggestion comes from the index only, and the suggested header is directly included</div><div></div><div>E) the suggestion comes from the index only, and the suggested header is not directly included</div><div><br></div><div>Currently we insert #includes in cases C and E.</div><div>Possible alternative behaviors (that could be controlled by a flag, or be the default):</div><div> - never insert. Allows completions of type E to break the code if the header is not transitively included.</div><div> - never insert, and disallow completions of type E. This will lose a lot of essential completions.</div><div> - insert in case E only. In case C, the code will still compile. This is somewhat a style question (include-what-you-use), but has some other subtle implications (e.g. for completions of incomplete class types).</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 3, 2019 at 11:38 AM Aneesh Kumar K.V 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:1px solid rgb(204,204,204);padding-left:1ex"><br>
Hi All,<br>
<br>
I am finding that with clangd after a function name code completion it<br>
adds a header to the top of the file. This almost always results in<br>
compilation error with my project and I would like to disable that<br>
header file addition to the .c file. I don't see a command line option<br>
that will help disable the feature. Any option i can use to disable?<br>
this?<br>
<br>
-aneesh<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>