mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-05-28 03:10:28 -04:00
fix: Exclude ignore file from attach
This commit is contained in:
parent
2b539bbdeb
commit
8a80dbe8f5
@ -510,7 +510,7 @@ void ChatRootView::onAppendLinkFileFromEditor(Core::IEditor *editor)
|
|||||||
{
|
{
|
||||||
if (auto document = editor->document(); document && isSyncOpenFiles()) {
|
if (auto document = editor->document(); document && isSyncOpenFiles()) {
|
||||||
QString filePath = document->filePath().toFSPathString();
|
QString filePath = document->filePath().toFSPathString();
|
||||||
if (!m_linkedFiles.contains(filePath)) {
|
if (!m_linkedFiles.contains(filePath) && !shouldIgnoreFileForAttach(document->filePath())) {
|
||||||
m_linkedFiles.append(filePath);
|
m_linkedFiles.append(filePath);
|
||||||
emit linkedFilesChanged();
|
emit linkedFilesChanged();
|
||||||
}
|
}
|
||||||
@ -537,4 +537,19 @@ void ChatRootView::setRecentFilePath(const QString &filePath)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ChatRootView::shouldIgnoreFileForAttach(const Utils::FilePath &filePath)
|
||||||
|
{
|
||||||
|
auto project = ProjectExplorer::ProjectManager::projectForFile(filePath);
|
||||||
|
if (project
|
||||||
|
&& m_clientInterface->contextManager()
|
||||||
|
->ignoreManager()
|
||||||
|
->shouldIgnore(filePath.toFSPathString(), project)) {
|
||||||
|
LOG_MESSAGE(QString("Ignoring file for attachment due to .qodeassistignore: %1")
|
||||||
|
.arg(filePath.toFSPathString()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace QodeAssist::Chat
|
} // namespace QodeAssist::Chat
|
||||||
|
@ -78,6 +78,7 @@ public:
|
|||||||
|
|
||||||
QString chatFileName() const;
|
QString chatFileName() const;
|
||||||
void setRecentFilePath(const QString &filePath);
|
void setRecentFilePath(const QString &filePath);
|
||||||
|
bool shouldIgnoreFileForAttach(const Utils::FilePath &filePath);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void sendMessage(const QString &message);
|
void sendMessage(const QString &message);
|
||||||
|
@ -37,24 +37,11 @@ IgnoreManager::IgnoreManager(QObject *parent)
|
|||||||
{
|
{
|
||||||
auto projectManager = ProjectExplorer::ProjectManager::instance();
|
auto projectManager = ProjectExplorer::ProjectManager::instance();
|
||||||
if (projectManager) {
|
if (projectManager) {
|
||||||
connect(
|
|
||||||
projectManager,
|
|
||||||
&ProjectExplorer::ProjectManager::projectAdded,
|
|
||||||
this,
|
|
||||||
&IgnoreManager::reloadIgnorePatterns);
|
|
||||||
|
|
||||||
connect(
|
connect(
|
||||||
projectManager,
|
projectManager,
|
||||||
&ProjectExplorer::ProjectManager::projectRemoved,
|
&ProjectExplorer::ProjectManager::projectRemoved,
|
||||||
this,
|
this,
|
||||||
&IgnoreManager::removeIgnorePatterns);
|
&IgnoreManager::removeIgnorePatterns);
|
||||||
|
|
||||||
const QList<ProjectExplorer::Project *> projects = projectManager->projects();
|
|
||||||
for (ProjectExplorer::Project *project : projects) {
|
|
||||||
if (project) {
|
|
||||||
reloadIgnorePatterns(project);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(
|
connect(
|
||||||
|
Loading…
Reference in New Issue
Block a user