Changeset View
Changeset View
Standalone View
Standalone View
clang-tools-extra/clangd/CodeComplete.cpp
Show First 20 Lines • Show All 389 Lines • ▼ Show 20 Lines | for (const auto &Inc : C.RankedIncludeHeaders) { | ||||
// FIXME: We should support #import directives here. | // FIXME: We should support #import directives here. | ||||
if ((Inc.Directive & clang::clangd::Symbol::Include) == 0) | if ((Inc.Directive & clang::clangd::Symbol::Include) == 0) | ||||
continue; | continue; | ||||
if (auto ToInclude = Inserted(Inc.Header)) { | if (auto ToInclude = Inserted(Inc.Header)) { | ||||
CodeCompletion::IncludeCandidate Include; | CodeCompletion::IncludeCandidate Include; | ||||
Include.Header = ToInclude->first; | Include.Header = ToInclude->first; | ||||
if (ToInclude->second && ShouldInsert) | if (ToInclude->second && ShouldInsert) | ||||
Include.Insertion = Includes.insert(ToInclude->first); | Include.Insertion = Includes.insert( | ||||
ToInclude->first, Inc.Directive == Symbol::Import); | |||||
Completion.Includes.push_back(std::move(Include)); | Completion.Includes.push_back(std::move(Include)); | ||||
} else | } else | ||||
log("Failed to generate include insertion edits for adding header " | log("Failed to generate include insertion edits for adding header " | ||||
"(FileURI='{0}', IncludeHeader='{1}') into {2}: {3}", | "(FileURI='{0}', IncludeHeader='{1}') into {2}: {3}", | ||||
C.IndexResult->CanonicalDeclaration.FileURI, Inc.Header, FileName, | C.IndexResult->CanonicalDeclaration.FileURI, Inc.Header, FileName, | ||||
ToInclude.takeError()); | ToInclude.takeError()); | ||||
} | } | ||||
// Prefer includes that do not need edits (i.e. already exist). | // Prefer includes that do not need edits (i.e. already exist). | ||||
▲ Show 20 Lines • Show All 1,874 Lines • Show Last 20 Lines |