HighCommander4 wrote: > > > What is the relationship between this patch, and clangd 17's ["missing > > > include" > > > warning](https://clangd.llvm.org/guides/include-cleaner#missing-include-warning)? > > > Does the quick-fix for the "missing include" warning also respect these > > > config options? > > As far as I can tell, clangd uses the correct header style for inserted > includes regardles of how those includes are created (via auto-include on > code completion or fix suggestions).
I played around with this a bit, and discovered that there are actually **three** situations in which clangd inserts a header: 1. During code completion ("header insertion") 2. In a quick-fix for an **error** diagnostic on an unresolved name ("include fixer") 3. In a quick-fix for a **warning** diagnostic (technically, a diagnostic with severity [`DiagnosticSeverity.Information`](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnosticSeverity)) on a name that's resolved, but where the file declaring it is not _directly_ included ("include cleaner") The patch seems to handle the first two, but not the third. The third scenario can be tested by creating a workspace with the following files: .clangd: ```yaml CompileFlags: Add: -I. Diagnostics: MissingIncludes: Strict Style: QuotedHeaders: "quoted/.*" AngledHeaders: "angled/.*" ``` quoted/quoted.hpp: ```c++ #ifndef QUOTED_HPP_ #define QUOTED_HPP_ void quoted(); #endif ``` angled/angled.hpp: ```c++ #ifndef ANGLED_HPP_ #define ANGLED_HPP_ void angled(); #endif ``` indirect.hpp: ```c++ #include "quoted/quoted.hpp" #include <angled/angled.hpp> ``` main.cpp: ```c++ #include "indirect.hpp" int main() { quoted(); angled(); } ``` Now, in main.cpp, if you hover over the `angled` token and accept the quick fix proposed there, the added include is spelled `"angled/angled.hpp"` rather than `<angled/angled.hpp>`. https://github.com/llvm/llvm-project/pull/67749 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits