fix: Found and fix review mistakes

This commit is contained in:
Petr Mironychev
2026-07-02 22:26:07 +02:00
parent c070d65366
commit 35bbaa1af0
139 changed files with 2032 additions and 1573 deletions

View File

@@ -56,14 +56,14 @@ void ChangesManager::addChange(
}
}
QString ChangesManager::getRecentChangesContext(const TextEditor::TextDocument *currentDocument) const
QString ChangesManager::getRecentChangesContext(const QString &currentFilePath) 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;

View File

@@ -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 &currentFilePath) 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,

View File

@@ -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};
}

View File

@@ -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;

View File

@@ -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())

View File

@@ -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;