MCPcopy Create free account
hub / github.com/Palm1r/QodeAssist / getCurrentFileContext

Method getCurrentFileContext

ChatView/ClientInterface.cpp:465–487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

463}
464
465QString ClientInterface::getCurrentFileContext() const
466{
467 auto currentEditor = Core::EditorManager::currentEditor();
468 if (!currentEditor) {
469 LOG_MESSAGE("No active editor found");
470 return QString();
471 }
472
473 auto textDocument = qobject_cast<TextEditor::TextDocument *>(currentEditor->document());
474 if (!textDocument) {
475 LOG_MESSAGE("Current document is not a text document");
476 return QString();
477 }
478
479 QString fileInfo = QString("Language: %1\nFile: %2\n\n")
480 .arg(textDocument->mimeType(), textDocument->filePath().toFSPathString());
481
482 QString content = textDocument->document()->toPlainText();
483
484 LOG_MESSAGE(QString("Got context from file: %1").arg(textDocument->filePath().toFSPathString()));
485
486 return QString("Current file context:\n%1\nFile content:\n%2").arg(fileInfo, content);
487}
488
489QString ClientInterface::getSystemPromptWithLinkedFiles(
490 const QString &basePrompt, const QList<QString> &linkedFiles) const

Callers

nothing calls this directly

Calls 2

documentMethod · 0.80
filePathMethod · 0.45

Tested by

no test coverage detected