forked from qt-creator/qt-creator
Add convenience functions for creating ProjectExplorer::HeaderPaths
Change-Id: I7b1f63caca6b70ba4ec1b1870b83cbf20aa6564a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -496,8 +496,8 @@ bool ClangCompletionAssistProcessor::completeInclude(const QTextCursor &cursor)
|
||||
|
||||
// Make completion for all relevant includes
|
||||
ProjectExplorer::HeaderPaths headerPaths = m_interface->headerPaths();
|
||||
const ProjectExplorer::HeaderPath currentFilePath(m_interface->filePath().toFileInfo().path(),
|
||||
ProjectExplorer::HeaderPathType::User);
|
||||
const auto currentFilePath = ProjectExplorer::HeaderPath::makeUser(
|
||||
m_interface->filePath().toFileInfo().path());
|
||||
if (!headerPaths.contains(currentFilePath))
|
||||
headerPaths.append(currentFilePath);
|
||||
|
||||
|
||||
@@ -95,14 +95,6 @@ public:
|
||||
TextEditor::ProposalModelPtr proposalModel;
|
||||
};
|
||||
|
||||
static const ProjectExplorer::HeaderPaths toHeaderPaths(const QStringList &paths)
|
||||
{
|
||||
ProjectExplorer::HeaderPaths result;
|
||||
foreach (const QString &path, paths)
|
||||
result.push_back({path, ProjectExplorer::HeaderPathType::User});
|
||||
return result;
|
||||
}
|
||||
|
||||
TextEditor::ProposalModelPtr completionResults(TextEditor::BaseTextEditor *textEditor,
|
||||
const QStringList &includePaths,
|
||||
int timeOutInMs)
|
||||
@@ -116,7 +108,7 @@ TextEditor::ProposalModelPtr completionResults(TextEditor::BaseTextEditor *textE
|
||||
QTC_ASSERT(assistInterface, return TextEditor::ProposalModelPtr());
|
||||
if (!includePaths.isEmpty()) {
|
||||
auto clangAssistInterface = static_cast<ClangCompletionAssistInterface *>(assistInterface);
|
||||
clangAssistInterface->setHeaderPaths(toHeaderPaths(includePaths));
|
||||
clangAssistInterface->setHeaderPaths(ProjectExplorer::toUserHeaderPaths(includePaths));
|
||||
}
|
||||
|
||||
CompletionAssistProvider *assistProvider
|
||||
|
||||
Reference in New Issue
Block a user