diff options
author | Filippo Cucchetto <filippocucchetto@gmail.com> | 2020-02-17 00:18:40 +0100 |
---|---|---|
committer | Filippo Cucchetto <filippocucchetto@gmail.com> | 2020-02-17 07:58:06 +0000 |
commit | a640eb8560454a7aed72c89b1cea02d769a779ed (patch) | |
tree | 6dd85ea7578b4d8a2cc9676b4851412276f85be1 /src/plugins/nim | |
parent | b9739c0945a1d7a1376f63c919ea9ec0f7f85ef8 (diff) |
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 <hjk@qt.io>
Diffstat (limited to 'src/plugins/nim')
-rw-r--r-- | src/plugins/nim/project/nimblebuildsystem.cpp | 12 | ||||
-rw-r--r-- | src/plugins/nim/project/nimbuildsystem.h | 2 |
2 files changed, 6 insertions, 8 deletions
diff --git a/src/plugins/nim/project/nimblebuildsystem.cpp b/src/plugins/nim/project/nimblebuildsystem.cpp index 4225de7574..e9abfe9601 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 665e217b0d..91d2e931c9 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: |