[PATCH] D139446: [clangd] Add flag to control #import include insertions
David Goldman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 9 07:04:04 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG814c0bb31660: [clangd] Add flag to control #import include insertions (authored by dgoldman).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139446/new/
https://reviews.llvm.org/D139446
Files:
clang-tools-extra/clangd/CodeComplete.h
clang-tools-extra/clangd/tool/ClangdMain.cpp
Index: clang-tools-extra/clangd/tool/ClangdMain.cpp
===================================================================
--- clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -264,6 +264,14 @@
"Never insert #include directives as part of code completion")),
};
+opt<bool> ImportInsertions{
+ "import-insertions",
+ cat(Features),
+ desc("If header insertion is enabled, add #import directives when "
+ "accepting code completions or fixing includes in Objective-C code"),
+ init(CodeCompleteOptions().ImportInsertions),
+};
+
opt<bool> IncludeCleanerStdlib{
"include-cleaner-stdlib",
cat(Features),
@@ -913,6 +921,7 @@
Opts.CodeComplete.BundleOverloads = CompletionStyle != Detailed;
Opts.CodeComplete.ShowOrigins = ShowOrigins;
Opts.CodeComplete.InsertIncludes = HeaderInsertion;
+ Opts.CodeComplete.ImportInsertions = ImportInsertions;
if (!HeaderInsertionDecorators) {
Opts.CodeComplete.IncludeIndicator.Insert.clear();
Opts.CodeComplete.IncludeIndicator.NoInsert.clear();
Index: clang-tools-extra/clangd/CodeComplete.h
===================================================================
--- clang-tools-extra/clangd/CodeComplete.h
+++ clang-tools-extra/clangd/CodeComplete.h
@@ -70,6 +70,10 @@
NeverInsert,
} InsertIncludes = IncludeInsertion::IWYU;
+ /// Whether include insertions for Objective-C code should use #import instead
+ /// of #include.
+ bool ImportInsertions = false;
+
/// A visual indicator to prepend to the completion label to indicate whether
/// completion result would trigger an #include insertion or not.
struct IncludeInsertionIndicator {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139446.487417.patch
Type: text/x-patch
Size: 1708 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230109/29d4b178/attachment-0001.bin>
More information about the cfe-commits
mailing list