refactor: Make DocumentContextReader usable outside Qt Creator context (#89)

This makes it possible to write simple unit tests for it without running
full Qt Creator. Not coupling DocumentContextReader to
TextEditor::TextDocument unnecessarily is also a better design in
general.
This commit is contained in:
Povilas Kanapickas
2025-03-05 02:53:02 +02:00
committed by GitHub
parent 29a3939c64
commit bcf7b6c226
3 changed files with 14 additions and 14 deletions

View File

@ -265,7 +265,8 @@ LLMCore::ContextData LLMClientInterface::prepareContext(
int cursorPosition = position["character"].toInt();
int lineNumber = position["line"].toInt();
Context::DocumentContextReader reader(textDocument);
Context::DocumentContextReader reader(
textDocument->document(), textDocument->mimeType(), textDocument->filePath().toString());
return reader.prepareContext(lineNumber, cursorPosition);
}