CMakeBuildSystem: Don't re-update code model on CMakeLists.txt saves

Currently if you edit a CMakeLists.txt and then press save, the code
model will be reindexed.

On projects like Qt Creator this operation is quite significant.

Note that the code model is updated after CMake has run on the project,
which is what I would expect.

Saving the CMakeLists.txt and not running CMake has no effect on the
project, and the code model shoudn't be reindexed.

Change-Id: I61289fda60752ef002cf3625d339d4fcaf144d1b
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Cristian Adam
2020-02-20 11:20:32 +01:00
committed by Tobias Hunger
parent 65e244b238
commit f65f260c91
3 changed files with 11 additions and 25 deletions

View File

@@ -26,6 +26,7 @@
#include "cmakebuildsystem.h"
#include "cmakebuildconfiguration.h"
#include "cmakekitinformation.h"
#include "cmakeproject.h"
#include "cmakeprojectconstants.h"
#include "cmakeprojectnodes.h"
@@ -204,10 +205,13 @@ CMakeBuildSystem::CMakeBuildSystem(CMakeBuildConfiguration *bc)
connect(project(), &Project::projectFileIsDirty, this, [this]() {
if (m_buildConfiguration->isActive()) {
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to dirty project file";
m_buildDirManager
.setParametersAndRequestParse(BuildDirParameters(m_buildConfiguration),
BuildDirManager::REPARSE_DEFAULT);
const auto cmake = CMakeKitAspect::cmakeTool(m_buildConfiguration->target()->kit());
if (cmake && cmake->isAutoRun()) {
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to dirty project file";
m_buildDirManager.setParametersAndRequestParse(BuildDirParameters(
m_buildConfiguration),
BuildDirManager::REPARSE_DEFAULT);
}
}
});

View File

@@ -63,18 +63,7 @@ using namespace FileApiDetails;
// FileApiReader:
// --------------------------------------------------------------------
FileApiReader::FileApiReader()
{
connect(Core::EditorManager::instance(),
&Core::EditorManager::aboutToSave,
this,
[this](const Core::IDocument *document) {
if (m_cmakeFiles.contains(document->filePath())) {
qCDebug(cmakeFileApiMode) << "FileApiReader: DIRTY SIGNAL";
emit dirty();
}
});
}
FileApiReader::FileApiReader() {}
FileApiReader::~FileApiReader()
{

View File

@@ -73,12 +73,6 @@ const int MAX_PROGRESS = 1400;
ServerModeReader::ServerModeReader()
{
connect(Core::EditorManager::instance(), &Core::EditorManager::aboutToSave,
this, [this](const Core::IDocument *document) {
if (m_cmakeFiles.contains(document->filePath()))
emit dirty();
});
connect(&m_parser, &CMakeParser::addOutput,
this, [](const QString &m) { Core::MessageManager::write(m); });
connect(&m_parser, &CMakeParser::addTask, this, [this](const Task &t) {
@@ -466,10 +460,9 @@ void ServerModeReader::handleProgress(int min, int cur, int max, const QString &
void ServerModeReader::handleSignal(const QString &signal, const QVariantMap &data)
{
Q_UNUSED(signal)
Q_UNUSED(data)
// CMake on Windows sends false dirty signals on each edit (QTCREATORBUG-17944)
if (!HostOsInfo::isWindowsHost() && signal == "dirty")
emit dirty();
// We do not need to act on fileChanged signals nor on dirty signals!
}
void ServerModeReader::handleServerConnected()