From a640eb8560454a7aed72c89b1cea02d769a779ed Mon Sep 17 00:00:00 2001 From: Filippo Cucchetto Date: Mon, 17 Feb 2020 00:18:40 +0100 Subject: Nim: workaround to project parsing loops Nimble creates temporaries files when querying the task list for the project files. For this reason we simply exclude requesting a project reparse when the root directory changes Change-Id: I6f1af3f073b056ecb2a7273fcb3df0cb44a1b53b Reviewed-by: hjk --- src/plugins/nim/project/nimblebuildsystem.cpp | 12 +++++------- src/plugins/nim/project/nimbuildsystem.h | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src/plugins/nim') diff --git a/src/plugins/nim/project/nimblebuildsystem.cpp b/src/plugins/nim/project/nimblebuildsystem.cpp index 4225de75740..e9abfe96019 100644 --- a/src/plugins/nim/project/nimblebuildsystem.cpp +++ b/src/plugins/nim/project/nimblebuildsystem.cpp @@ -109,11 +109,6 @@ static NimbleMetadata parseMetadata(const QString &nimblePath, const QString &wo NimbleBuildSystem::NimbleBuildSystem(Target *target) : BuildSystem(target), m_projectScanner(target->project()) { - // Not called in parseProject due to nimble behavior to create temporary - // files in project directory. This creation in turn stimulate the fs watcher - // that in turn causes project parsing (thus a loop if invoke in parseProject). - // For this reason we call this function manually during project creation - // See https://github.com/nim-lang/nimble/issues/720 m_projectScanner.watchProjectFilePath(); connect(&m_projectScanner, &NimProjectScanner::fileChanged, this, [this](const QString &path) { @@ -126,8 +121,11 @@ NimbleBuildSystem::NimbleBuildSystem(Target *target) connect(&m_projectScanner, &NimProjectScanner::finished, this, &NimbleBuildSystem::updateProject); - connect(&m_projectScanner, &NimProjectScanner::directoryChanged, this, [this] { - if (!isWaitingForParse()) + connect(&m_projectScanner, &NimProjectScanner::directoryChanged, this, [this] (const QString &directory){ + // Workaround for nimble creating temporary files in project root directory + // when querying the list of tasks. + // See https://github.com/nim-lang/nimble/issues/720 + if (directory != projectDirectory().toString()) requestDelayedParse(); }); diff --git a/src/plugins/nim/project/nimbuildsystem.h b/src/plugins/nim/project/nimbuildsystem.h index 665e217b0d6..91d2e931c91 100644 --- a/src/plugins/nim/project/nimbuildsystem.h +++ b/src/plugins/nim/project/nimbuildsystem.h @@ -53,7 +53,7 @@ public: signals: void finished(); void requestReparse(); - void directoryChanged(); + void directoryChanged(const QString &path); void fileChanged(const QString &path); private: -- cgit v1.2.3