fix: Check patterns and remove filewatcher (#166)

* fix: Check patterns and remove filewatcher
* fix: Don't show log for non-existent ignore file
This commit is contained in:
Petr Mironychev
2025-04-18 10:55:46 +02:00
committed by GitHub
parent 2f9622e23e
commit 8cb6a2f6d2
2 changed files with 195 additions and 54 deletions

View File

@ -19,9 +19,9 @@
#pragma once
#include <QFileSystemWatcher>
#include <QMap>
#include <QHash>
#include <QObject>
#include <QPointer>
#include <QStringList>
namespace ProjectExplorer {
@ -40,15 +40,23 @@ public:
bool shouldIgnore(const QString &filePath, ProjectExplorer::Project *project = nullptr) const;
void reloadIgnorePatterns(ProjectExplorer::Project *project);
void removeIgnorePatterns(ProjectExplorer::Project *project);
void reloadAllPatterns();
private slots:
void cleanupConnections();
private:
QStringList loadIgnorePatterns(ProjectExplorer::Project *project);
bool matchesIgnorePatterns(const QString &path, const QStringList &patterns) const;
bool isPathExcluded(const QString &path, const QStringList &patterns) const;
bool matchPathWithPattern(const QString &path, const QString &pattern) const;
QStringList loadIgnorePatterns(ProjectExplorer::Project *project);
QString ignoreFilePath(ProjectExplorer::Project *project) const;
mutable QMap<ProjectExplorer::Project *, QStringList> m_projectIgnorePatterns;
QFileSystemWatcher m_fileWatcher;
QMap<ProjectExplorer::Project *, QMetaObject::Connection> m_projectConnections;
QHash<ProjectExplorer::Project *, QStringList> m_projectIgnorePatterns;
mutable QHash<QString, bool> m_ignoreCache;
QHash<ProjectExplorer::Project *, QMetaObject::Connection> m_projectConnections;
};
} // namespace QodeAssist::Context