| 138 | } |
| 139 | |
| 140 | QString ContextManager::openedFilesContext(const QStringList excludeFiles) |
| 141 | { |
| 142 | QString context = "User files context:\n"; |
| 143 | |
| 144 | auto documents = Core::DocumentModel::openedDocuments(); |
| 145 | |
| 146 | for (const auto *document : documents) { |
| 147 | auto textDocument = qobject_cast<const TextEditor::TextDocument *>(document); |
| 148 | if (!textDocument) |
| 149 | continue; |
| 150 | |
| 151 | auto filePath = textDocument->filePath().toUrlishString(); |
| 152 | if (excludeFiles.contains(filePath)) |
| 153 | continue; |
| 154 | |
| 155 | auto project = ProjectExplorer::ProjectManager::projectForFile(textDocument->filePath()); |
| 156 | if (project && m_ignoreManager->shouldIgnore(filePath, project)) { |
| 157 | LOG_MESSAGE( |
| 158 | QString("Ignoring file in context due to .qodeassistignore: %1").arg(filePath)); |
| 159 | continue; |
| 160 | } |
| 161 | |
| 162 | context += QString("File: %1\n").arg(filePath); |
| 163 | context += textDocument->plainText(); |
| 164 | |
| 165 | context += "\n"; |
| 166 | } |
| 167 | |
| 168 | return context; |
| 169 | } |
| 170 | |
| 171 | IgnoreManager *ContextManager::ignoreManager() const |
| 172 | { |
no test coverage detected