diff options
Diffstat (limited to 'src/plugins/nim/project/nimblebuildsystem.cpp')
-rw-r--r-- | src/plugins/nim/project/nimblebuildsystem.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/plugins/nim/project/nimblebuildsystem.cpp b/src/plugins/nim/project/nimblebuildsystem.cpp index c8d0e81d9a..d968b50391 100644 --- a/src/plugins/nim/project/nimblebuildsystem.cpp +++ b/src/plugins/nim/project/nimblebuildsystem.cpp @@ -105,6 +105,19 @@ NimbleMetadata parseMetadata(const QString &nimblePath, const QString &workingDi NimbleBuildSystem::NimbleBuildSystem(Project *project) : NimBuildSystem(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_directoryWatcher.addFile(this->project()->projectFilePath().toString(), + FileSystemWatcher::WatchModifiedDate); + connect(&m_directoryWatcher, &FileSystemWatcher::fileChanged, this, [this](const QString &path) { + if (path == this->project()->projectFilePath().toString()) { + updateProject(); + } + }); + updateProject(); } void NimbleBuildSystem::parseProject(BuildSystem::ParsingContext &&ctx) @@ -118,22 +131,6 @@ void NimbleBuildSystem::updateProject() updateProjectTasks(); } -void NimbleBuildSystem::init() -{ - // 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_directoryWatcher.addFile(project()->projectFilePath().toString(), FileSystemWatcher::WatchModifiedDate); - connect(&m_directoryWatcher, &FileSystemWatcher::fileChanged, this, [this](const QString &path) { - if (path == project()->projectFilePath().toString()) { - updateProject(); - } - }); - updateProject(); -} - void NimbleBuildSystem::updateProjectTasks() { auto prj = dynamic_cast<NimbleProject*>(project()); |