mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-07-07 05:29:13 -04:00
fix: Found and fix review mistakes
This commit is contained in:
@@ -56,14 +56,14 @@ void ChangesManager::addChange(
|
||||
}
|
||||
}
|
||||
|
||||
QString ChangesManager::getRecentChangesContext(const TextEditor::TextDocument *currentDocument) const
|
||||
QString ChangesManager::getRecentChangesContext(const QString ¤tFilePath) const
|
||||
{
|
||||
QString context;
|
||||
for (auto it = m_documentChanges.constBegin(); it != m_documentChanges.constEnd(); ++it) {
|
||||
if (it.key() != currentDocument) {
|
||||
for (const auto &change : it.value()) {
|
||||
context += change.lineContent + "\n";
|
||||
}
|
||||
if (it.key() && it.key()->filePath().toFSPathString() == currentFilePath)
|
||||
continue;
|
||||
for (const auto &change : it.value()) {
|
||||
context += change.lineContent + "\n";
|
||||
}
|
||||
}
|
||||
return context;
|
||||
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
|
||||
void addChange(
|
||||
TextEditor::TextDocument *document, int position, int charsRemoved, int charsAdded);
|
||||
QString getRecentChangesContext(const TextEditor::TextDocument *currentDocument) const;
|
||||
QString getRecentChangesContext(const QString ¤tFilePath) const;
|
||||
|
||||
void addFileEdit(
|
||||
const QString &editId,
|
||||
@@ -106,9 +106,10 @@ private:
|
||||
ChangesManager &operator=(const ChangesManager &) = delete;
|
||||
|
||||
QString readFileContent(const QString &filePath) const;
|
||||
|
||||
DiffInfo createDiffInfo(const QString &originalContent, const QString &modifiedContent, const QString &filePath);
|
||||
|
||||
|
||||
DiffInfo createDiffInfo(
|
||||
const QString &originalContent, const QString &modifiedContent, const QString &filePath);
|
||||
|
||||
// Helper method for fragment-based apply/undo operations
|
||||
bool performFragmentReplacement(
|
||||
const QString &filePath,
|
||||
|
||||
@@ -263,7 +263,7 @@ Templates::ContextData DocumentContextReader::prepareContext(
|
||||
|
||||
if (settings.useProjectChangesCache())
|
||||
fileContext.append("Recent Project Changes Context:\n ")
|
||||
.append(ChangesManager::instance().getRecentChangesContext(m_textDocument));
|
||||
.append(ChangesManager::instance().getRecentChangesContext(m_filePath));
|
||||
|
||||
return {.prefix = contextBefore, .suffix = contextAfter, .fileContext = fileContext};
|
||||
}
|
||||
|
||||
@@ -4,11 +4,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <texteditor/textdocument.h>
|
||||
#include <QTextDocument>
|
||||
|
||||
#include <sources/common/ContextData.hpp>
|
||||
#include <settings/CodeCompletionSettings.hpp>
|
||||
#include <sources/common/ContextData.hpp>
|
||||
|
||||
namespace QodeAssist::Context {
|
||||
|
||||
@@ -59,7 +58,6 @@ public:
|
||||
int lineNumber, int cursorPosition, const Settings::CodeCompletionSettings &settings) const;
|
||||
|
||||
private:
|
||||
TextEditor::TextDocument *m_textDocument = nullptr;
|
||||
QTextDocument *m_document;
|
||||
QString m_mimeType;
|
||||
QString m_filePath;
|
||||
|
||||
@@ -51,8 +51,8 @@ QString formatProject(const ProjectEnv &env)
|
||||
|
||||
QString formatFile(const FileEnv &env)
|
||||
{
|
||||
const QString language
|
||||
= LanguageServerProtocol::TextDocumentItem::mimeTypeToLanguageId(env.mimeType);
|
||||
const QString language = LanguageServerProtocol::TextDocumentItem::mimeTypeToLanguageId(
|
||||
env.mimeType);
|
||||
|
||||
QString out = QStringLiteral("File information:");
|
||||
if (!language.isEmpty())
|
||||
|
||||
@@ -20,8 +20,7 @@ ProjectScannerQtCreator::ProjectScannerQtCreator()
|
||||
|
||||
ProjectScannerQtCreator::~ProjectScannerQtCreator() = default;
|
||||
|
||||
QList<OpenedTextFile> ProjectScannerQtCreator::openedTextFiles(
|
||||
const QStringList &excludeFiles) const
|
||||
QList<OpenedTextFile> ProjectScannerQtCreator::openedTextFiles(const QStringList &excludeFiles) const
|
||||
{
|
||||
QList<OpenedTextFile> files;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user