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:
Nikolai Kosjar
2017-01-17 15:27:31 +01:00
parent 19eaf87ef9
commit 0b8df41387
19 changed files with 235 additions and 116 deletions

View File

@@ -25,8 +25,8 @@
#pragma once
#include "cpplanguage.h"
#include "cpptools_global.h"
#include "cpptools_utils.h"
#include "cppworkingcopy.h"
#include "projectpart.h"
@@ -82,22 +82,26 @@ public:
void update(const UpdateParams &updateParams);
void update(const QFutureInterface<void> &future, const UpdateParams &updateParams);
ProjectPart::Ptr projectPart() const;
ProjectPartInfo projectPartInfo() const;
signals:
void projectPartInfoUpdated(const CppTools::ProjectPartInfo &projectPartInfo);
protected:
struct State {
QByteArray editorDefines;
ProjectPart::Ptr projectPart;
ProjectPartInfo projectPartInfo;
};
State state() const;
void setState(const State &state);
static ProjectPart::Ptr determineProjectPart(const QString &filePath,
const Configuration &config,
const State &state,
const ProjectExplorer::Project *activeProject,
Language languagePreference,
bool hasActiveProjectChanged);
static ProjectPartInfo determineProjectPart(
const QString &filePath,
const Configuration &config,
const State &state,
const ProjectExplorer::Project *activeProject,
Language languagePreference,
bool hasActiveProjectChanged);
mutable QMutex m_stateAndConfigurationMutex;