feat: Improve describe recent changes in system prompt (#113)

Co-authored-by: Petr Mironychev <9195189+Palm1r@users.noreply.github.com>
This commit is contained in:
Povilas Kanapickas
2025-03-08 09:58:28 +02:00
committed by GitHub
parent f94c79a5ff
commit 3aae923d43
2 changed files with 8 additions and 5 deletions

View File

@ -275,8 +275,8 @@ LLMCore::ContextData DocumentContextReader::prepareContext(
fileContext.append("\n ").append(getLanguageAndFileInfo());
if (settings.useProjectChangesCache())
fileContext.append("\n ").append(
ChangesManager::instance().getRecentChangesContext(m_textDocument));
fileContext.append("Recent Project Changes Context:\n ")
.append(ChangesManager::instance().getRecentChangesContext(m_textDocument));
return {.prefix = contextBefore, .suffix = contextAfter, .fileContext = fileContext};
}

View File

@ -372,21 +372,24 @@ TEST_F(DocumentContextReaderTest, testPrepareContext)
(ContextData{
.prefix = "Line 0\nLine 1\nLin",
.suffix = "e 2\nLine 3\nLine 4",
.fileContext = "\n Language: (MIME: text/python) filepath: /path/to/file()\n\n\n "}));
.fileContext = "\n Language: (MIME: text/python) filepath: /path/to/file()\n\n"
"Recent Project Changes Context:\n "}));
EXPECT_EQ(
reader.prepareContext(2, 3, *createSettingsForLines(1, 1)),
(ContextData{
.prefix = "Line 1\nLin",
.suffix = "e 2\nLine 3",
.fileContext = "\n Language: (MIME: text/python) filepath: /path/to/file()\n\n\n "}));
.fileContext = "\n Language: (MIME: text/python) filepath: /path/to/file()\n\n"
"Recent Project Changes Context:\n "}));
EXPECT_EQ(
reader.prepareContext(2, 3, *createSettingsForLines(2, 2)),
(ContextData{
.prefix = "Line 0\nLine 1\nLin",
.suffix = "e 2\nLine 3\nLine 4",
.fileContext = "\n Language: (MIME: text/python) filepath: /path/to/file()\n\n\n "}));
.fileContext = "\n Language: (MIME: text/python) filepath: /path/to/file()\n\n"
"Recent Project Changes Context:\n "}));
}
#include "DocumentContextReaderTest.moc"