forked from qt-creator/qt-creator
CppTools: Provide hints about chosen project part for editor document
Parse issues can have multiple reasons (invalid kit, not a project file, actual parse issue) and we should be able to tell them apart. With this change, we can distinguish between the fallback project part and a ambiguous project part. Follow up changes will use this to display more accurate diagnostics. Change-Id: Icc8767607cc17dc14d6227b07f34e81ba5525a96 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -39,12 +39,13 @@ void ClangEditorDocumentParser::updateImpl(const QFutureInterface<void> &,
|
||||
const UpdateParams &updateParams)
|
||||
{
|
||||
State state_ = state();
|
||||
state_.projectPart = determineProjectPart(filePath(),
|
||||
configuration(),
|
||||
state_,
|
||||
updateParams.activeProject,
|
||||
updateParams.languagePreference,
|
||||
updateParams.hasActiveProjectChanged);
|
||||
state_.projectPartInfo = determineProjectPart(filePath(),
|
||||
configuration(),
|
||||
state_,
|
||||
updateParams.activeProject,
|
||||
updateParams.languagePreference,
|
||||
updateParams.hasActiveProjectChanged);
|
||||
emit projectPartInfoUpdated(state_.projectPartInfo);
|
||||
setState(state_);
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,9 @@ ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(
|
||||
connect(&m_updateTranslationUnitTimer, &QTimer::timeout,
|
||||
this, &ClangEditorDocumentProcessor::updateTranslationUnitIfProjectPartExists);
|
||||
|
||||
connect(m_parser.data(), &ClangEditorDocumentParser::projectPartInfoUpdated,
|
||||
this, &BaseEditorDocumentProcessor::projectPartInfoUpdated);
|
||||
|
||||
// Forwarding the semantic info from the builtin processor enables us to provide all
|
||||
// editor (widget) related features that are not yet implemented by the clang plugin.
|
||||
connect(&m_builtinProcessor, &CppTools::BuiltinEditorDocumentProcessor::cppDocumentUpdated,
|
||||
@@ -302,7 +305,7 @@ static bool isProjectPartLoadedOrIsFallback(CppTools::ProjectPart::Ptr projectPa
|
||||
|
||||
void ClangEditorDocumentProcessor::updateProjectPartAndTranslationUnitForEditor()
|
||||
{
|
||||
const CppTools::ProjectPart::Ptr projectPart = m_parser->projectPart();
|
||||
const CppTools::ProjectPart::Ptr projectPart = m_parser->projectPartInfo().projectPart;
|
||||
|
||||
if (isProjectPartLoadedOrIsFallback(projectPart)) {
|
||||
registerTranslationUnitForEditor(projectPart.data());
|
||||
|
||||
@@ -131,7 +131,7 @@ QStringList createClangOptions(const ProjectPart::Ptr &pPart, ProjectFile::Kind
|
||||
ProjectPart::Ptr projectPartForFile(const QString &filePath)
|
||||
{
|
||||
if (const auto parser = CppTools::BaseEditorDocumentParser::get(filePath))
|
||||
return parser->projectPart();
|
||||
return parser->projectPartInfo().projectPart;
|
||||
return ProjectPart::Ptr();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user