mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-11-13 13:32:55 -05:00
feat: Add edit file tool (#249)
* feat: Add edit file tool * feat: Add icons for action buttons
This commit is contained in:
@ -19,6 +19,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "FileSearchUtils.hpp"
|
||||
|
||||
#include <context/IgnoreManager.hpp>
|
||||
#include <llmcore/BaseTool.hpp>
|
||||
#include <QFuture>
|
||||
@ -42,38 +44,7 @@ public:
|
||||
QFuture<QString> executeAsync(const QJsonObject &input) override;
|
||||
|
||||
private:
|
||||
enum class MatchType { ExactName, PathMatch, PartialName };
|
||||
|
||||
struct FileMatch
|
||||
{
|
||||
QString absolutePath;
|
||||
QString relativePath;
|
||||
QString projectName;
|
||||
QString content;
|
||||
MatchType matchType;
|
||||
bool contentRead = false;
|
||||
QString error;
|
||||
|
||||
bool operator<(const FileMatch &other) const
|
||||
{
|
||||
return static_cast<int>(matchType) < static_cast<int>(other.matchType);
|
||||
}
|
||||
};
|
||||
|
||||
FileMatch findBestMatch(const QString &query, const QString &filePattern, int maxResults);
|
||||
void searchInFileSystem(
|
||||
const QString &dirPath,
|
||||
const QString &query,
|
||||
const QString &projectName,
|
||||
const QString &projectDir,
|
||||
ProjectExplorer::Project *project,
|
||||
QList<FileMatch> &matches,
|
||||
int maxResults,
|
||||
int ¤tDepth,
|
||||
int maxDepth = 5);
|
||||
bool matchesFilePattern(const QString &fileName, const QString &pattern) const;
|
||||
QString readFileContent(const QString &filePath) const;
|
||||
QString formatResult(const FileMatch &match, bool readContent) const;
|
||||
QString formatResult(const FileSearchUtils::FileMatch &match, bool readContent) const;
|
||||
|
||||
Context::IgnoreManager *m_ignoreManager;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user