MythreyaK wrote:

> One issue that I see with the current implementation is that it makes the 
> command-line flag `--header-insertion=never` have no effect.

Oh right! I completely forgot about that. 

> To get the command line flag to interact with the config option better, we 
> need to handle it in 
> [`FlagsConfigProvider`](https://searchfox.org/llvm/rev/107aa6a3d3ab96b7eec55e1ec5c3eabfa6ab2f9f/clang-tools-extra/clangd/tool/ClangdMain.cpp#655),
>  which gives the command-line flag the ability to influence the value of 
> `Config::current().HeaderInsertion.Policy`.
> 
> We have a few options regarding the precedence, but I think the simplest to 
> implement is to handle it similar to --background-index 
> [here](https://searchfox.org/llvm/rev/107aa6a3d3ab96b7eec55e1ec5c3eabfa6ab2f9f/clang-tools-extra/clangd/tool/ClangdMain.cpp#711-713):
>  if the flag's value is NeverInsert, then write that into the config object, 
> otherwise leave it alone.

Clarification, so if the user has `IWYU` in CLI, but `never` in the config, 
`never` is what will be used? 

> Since header insertion is a side effect of accepting of code completion 
> proposal, it would make sense to have this option under `Completion` rather 
> than at the top level.

Sounds good, I'll update my patch shortly. 

https://github.com/llvm/llvm-project/pull/128503
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to