diff --git a/src/core/webview/webviewMessageHandler.ts b/src/core/webview/webviewMessageHandler.ts index e70b39df8f..ed5f30ef19 100644 --- a/src/core/webview/webviewMessageHandler.ts +++ b/src/core/webview/webviewMessageHandler.ts @@ -2107,6 +2107,21 @@ export const webviewMessageHandler = async ( } break } + case "resumeIndexing": { + try { + const manager = provider.codeIndexManager! + if (manager.isFeatureEnabled && manager.isFeatureConfigured) { + if (!manager.isInitialized) { + await manager.initialize(provider.contextProxy) + } + + manager.resumeIndexing() + } + } catch (error) { + provider.log(`Error resuming indexing: ${error instanceof Error ? error.message : String(error)}`) + } + break + } case "clearIndexData": { try { const manager = provider.codeIndexManager! diff --git a/src/services/code-index/manager.ts b/src/services/code-index/manager.ts index 18e0752c34..9f21894122 100644 --- a/src/services/code-index/manager.ts +++ b/src/services/code-index/manager.ts @@ -167,6 +167,17 @@ export class CodeIndexManager { await this._orchestrator!.startIndexing() } + /** + * Resumes the indexing process from where it left off after an error. + */ + public async resumeIndexing(): Promise { + if (!this.isFeatureEnabled) { + return + } + this.assertInitialized() + await this._orchestrator!.resumeIndexing() + } + /** * Stops the file watcher and potentially cleans up resources. */ diff --git a/src/services/code-index/orchestrator.ts b/src/services/code-index/orchestrator.ts index 505aee7668..1e07f98fed 100644 --- a/src/services/code-index/orchestrator.ts +++ b/src/services/code-index/orchestrator.ts @@ -226,6 +226,32 @@ export class CodeIndexOrchestrator { } } + /** + * Resumes the indexing process from where it left off after an error. + * This is similar to startIndexing but designed to continue from a failed state. + */ + public async resumeIndexing(): Promise { + if (!this.configManager.isFeatureConfigured) { + this.stateManager.setSystemState("Standby", "Missing configuration. Save your settings to start indexing.") + console.warn("[CodeIndexOrchestrator] Resume rejected: Missing configuration.") + return + } + + if ( + this._isProcessing || + (this.stateManager.state !== "Error" && this.stateManager.state !== "Standby") + ) { + console.warn( + `[CodeIndexOrchestrator] Resume rejected: Already processing or not in error/standby state ${this.stateManager.state}.`, + ) + return + } + + // For now, resumeIndexing will behave the same as startIndexing + // In the future, this could be enhanced to track failed files and only re-process those + await this.startIndexing() + } + /** * Stops the file watcher and cleans up resources. */ diff --git a/src/shared/WebviewMessage.ts b/src/shared/WebviewMessage.ts index d5dc3f8c28..3502f147fb 100644 --- a/src/shared/WebviewMessage.ts +++ b/src/shared/WebviewMessage.ts @@ -168,6 +168,7 @@ export interface WebviewMessage { | "condenseTaskContextRequest" | "requestIndexingStatus" | "startIndexing" + | "resumeIndexing" | "clearIndexData" | "indexingStatusUpdate" | "indexCleared" diff --git a/webview-ui/src/components/chat/CodeIndexPopover.tsx b/webview-ui/src/components/chat/CodeIndexPopover.tsx index b5742cc623..e2563ccba0 100644 --- a/webview-ui/src/components/chat/CodeIndexPopover.tsx +++ b/webview-ui/src/components/chat/CodeIndexPopover.tsx @@ -1083,8 +1083,16 @@ export const CodeIndexPopover: React.FC = ({
{currentSettings.codebaseIndexEnabled && - (indexingStatus.systemStatus === "Error" || - indexingStatus.systemStatus === "Standby") && ( + indexingStatus.systemStatus === "Error" && ( + vscode.postMessage({ type: "resumeIndexing" })} + disabled={saveStatus === "saving" || hasUnsavedChanges}> + {t("settings:codeIndex.resumeIndexingButton")} + + )} + + {currentSettings.codebaseIndexEnabled && + indexingStatus.systemStatus === "Standby" && ( vscode.postMessage({ type: "startIndexing" })} disabled={saveStatus === "saving" || hasUnsavedChanges}> diff --git a/webview-ui/src/i18n/locales/ca/settings.json b/webview-ui/src/i18n/locales/ca/settings.json index 15018e64ab..793f6bb558 100644 --- a/webview-ui/src/i18n/locales/ca/settings.json +++ b/webview-ui/src/i18n/locales/ca/settings.json @@ -63,6 +63,7 @@ "qdrantUrlLabel": "URL de Qdrant", "qdrantKeyLabel": "Clau de Qdrant:", "startIndexingButton": "Iniciar", + "resumeIndexingButton": "Resume", "clearIndexDataButton": "Esborrar índex", "unsavedSettingsMessage": "Si us plau, deseu la configuració abans d'iniciar el procés d'indexació.", "clearDataDialog": { diff --git a/webview-ui/src/i18n/locales/de/settings.json b/webview-ui/src/i18n/locales/de/settings.json index bb5ed1146b..c6c43af1e1 100644 --- a/webview-ui/src/i18n/locales/de/settings.json +++ b/webview-ui/src/i18n/locales/de/settings.json @@ -74,6 +74,7 @@ "qdrantApiKeyPlaceholder": "Gib deinen Qdrant API-Schlüssel ein (optional)", "setupConfigLabel": "Einrichtung", "startIndexingButton": "Start", + "resumeIndexingButton": "Fortsetzen", "clearIndexDataButton": "Index löschen", "unsavedSettingsMessage": "Bitte speichere deine Einstellungen, bevor du den Indexierungsprozess startest.", "clearDataDialog": { diff --git a/webview-ui/src/i18n/locales/en/settings.json b/webview-ui/src/i18n/locales/en/settings.json index 728e856502..0c25fd3787 100644 --- a/webview-ui/src/i18n/locales/en/settings.json +++ b/webview-ui/src/i18n/locales/en/settings.json @@ -81,6 +81,7 @@ "searchMaxResultsDescription": "Maximum number of search results to return when querying the codebase index. Higher values provide more context but may include less relevant results.", "resetToDefault": "Reset to default", "startIndexingButton": "Start Indexing", + "resumeIndexingButton": "Resume Indexing", "clearIndexDataButton": "Clear Index Data", "unsavedSettingsMessage": "Please save your settings before starting the indexing process.", "clearDataDialog": { diff --git a/webview-ui/src/i18n/locales/es/settings.json b/webview-ui/src/i18n/locales/es/settings.json index 5836933b46..d0f87261a5 100644 --- a/webview-ui/src/i18n/locales/es/settings.json +++ b/webview-ui/src/i18n/locales/es/settings.json @@ -74,6 +74,7 @@ "qdrantApiKeyPlaceholder": "Introduce tu clave API de Qdrant (opcional)", "setupConfigLabel": "Configuración", "startIndexingButton": "Iniciar", + "resumeIndexingButton": "Reanudar", "clearIndexDataButton": "Borrar índice", "unsavedSettingsMessage": "Por favor guarda tus ajustes antes de iniciar el proceso de indexación.", "clearDataDialog": { diff --git a/webview-ui/src/i18n/locales/fr/settings.json b/webview-ui/src/i18n/locales/fr/settings.json index 833a789e5a..4c02518caf 100644 --- a/webview-ui/src/i18n/locales/fr/settings.json +++ b/webview-ui/src/i18n/locales/fr/settings.json @@ -74,6 +74,7 @@ "qdrantApiKeyPlaceholder": "Entrez votre clé API Qdrant (optionnel)", "setupConfigLabel": "Configuration", "startIndexingButton": "Démarrer", + "resumeIndexingButton": "Reprendre", "clearIndexDataButton": "Effacer l'index", "unsavedSettingsMessage": "Merci d'enregistrer tes paramètres avant de démarrer le processus d'indexation.", "clearDataDialog": { diff --git a/webview-ui/src/i18n/locales/hi/settings.json b/webview-ui/src/i18n/locales/hi/settings.json index 0749943508..0361dea07e 100644 --- a/webview-ui/src/i18n/locales/hi/settings.json +++ b/webview-ui/src/i18n/locales/hi/settings.json @@ -63,6 +63,7 @@ "qdrantUrlLabel": "Qdrant URL", "qdrantKeyLabel": "Qdrant कुंजी:", "startIndexingButton": "शुरू करें", + "resumeIndexingButton": "Resume", "clearIndexDataButton": "इंडेक्स साफ़ करें", "unsavedSettingsMessage": "इंडेक्सिंग प्रक्रिया शुरू करने से पहले कृपया अपनी सेटिंग्स सहेजें।", "clearDataDialog": { diff --git a/webview-ui/src/i18n/locales/id/settings.json b/webview-ui/src/i18n/locales/id/settings.json index 4a0c51d39d..4442340f4e 100644 --- a/webview-ui/src/i18n/locales/id/settings.json +++ b/webview-ui/src/i18n/locales/id/settings.json @@ -63,6 +63,7 @@ "qdrantUrlLabel": "Qdrant URL", "qdrantKeyLabel": "Qdrant Key:", "startIndexingButton": "Mulai", + "resumeIndexingButton": "Resume", "clearIndexDataButton": "Hapus Indeks", "unsavedSettingsMessage": "Silakan simpan pengaturan kamu sebelum memulai proses pengindeksan.", "clearDataDialog": { diff --git a/webview-ui/src/i18n/locales/it/settings.json b/webview-ui/src/i18n/locales/it/settings.json index 9d9be82868..9870b41c64 100644 --- a/webview-ui/src/i18n/locales/it/settings.json +++ b/webview-ui/src/i18n/locales/it/settings.json @@ -63,6 +63,7 @@ "qdrantUrlLabel": "URL Qdrant", "qdrantKeyLabel": "Chiave Qdrant:", "startIndexingButton": "Avvia", + "resumeIndexingButton": "Resume", "clearIndexDataButton": "Cancella indice", "unsavedSettingsMessage": "Per favore salva le tue impostazioni prima di avviare il processo di indicizzazione.", "clearDataDialog": { diff --git a/webview-ui/src/i18n/locales/ja/settings.json b/webview-ui/src/i18n/locales/ja/settings.json index 9fc03cbfb1..2657913dbf 100644 --- a/webview-ui/src/i18n/locales/ja/settings.json +++ b/webview-ui/src/i18n/locales/ja/settings.json @@ -63,6 +63,7 @@ "qdrantUrlLabel": "Qdrant URL", "qdrantKeyLabel": "Qdrantキー:", "startIndexingButton": "開始", + "resumeIndexingButton": "再開", "clearIndexDataButton": "インデックスクリア", "unsavedSettingsMessage": "インデックス作成プロセスを開始する前に設定を保存してください。", "clearDataDialog": { diff --git a/webview-ui/src/i18n/locales/ko/settings.json b/webview-ui/src/i18n/locales/ko/settings.json index 219daa05a4..17a408afad 100644 --- a/webview-ui/src/i18n/locales/ko/settings.json +++ b/webview-ui/src/i18n/locales/ko/settings.json @@ -63,6 +63,7 @@ "qdrantUrlLabel": "Qdrant URL", "qdrantKeyLabel": "Qdrant 키:", "startIndexingButton": "시작", + "resumeIndexingButton": "Resume", "clearIndexDataButton": "인덱스 지우기", "unsavedSettingsMessage": "인덱싱 프로세스를 시작하기 전에 설정을 저장해 주세요.", "clearDataDialog": { diff --git a/webview-ui/src/i18n/locales/nl/settings.json b/webview-ui/src/i18n/locales/nl/settings.json index e184f4d85e..a99ae42720 100644 --- a/webview-ui/src/i18n/locales/nl/settings.json +++ b/webview-ui/src/i18n/locales/nl/settings.json @@ -63,6 +63,7 @@ "qdrantUrlLabel": "Qdrant URL", "qdrantKeyLabel": "Qdrant-sleutel:", "startIndexingButton": "Start", + "resumeIndexingButton": "Resume", "clearIndexDataButton": "Index wissen", "unsavedSettingsMessage": "Sla je instellingen op voordat je het indexeringsproces start.", "clearDataDialog": { diff --git a/webview-ui/src/i18n/locales/pl/settings.json b/webview-ui/src/i18n/locales/pl/settings.json index 23d3ce707d..b63cc777c8 100644 --- a/webview-ui/src/i18n/locales/pl/settings.json +++ b/webview-ui/src/i18n/locales/pl/settings.json @@ -63,6 +63,7 @@ "qdrantUrlLabel": "URL Qdrant", "qdrantKeyLabel": "Klucz Qdrant:", "startIndexingButton": "Rozpocznij", + "resumeIndexingButton": "Resume", "clearIndexDataButton": "Wyczyść indeks", "unsavedSettingsMessage": "Zapisz swoje ustawienia przed rozpoczęciem procesu indeksowania.", "clearDataDialog": { diff --git a/webview-ui/src/i18n/locales/pt-BR/settings.json b/webview-ui/src/i18n/locales/pt-BR/settings.json index 102036622c..95873a4b5b 100644 --- a/webview-ui/src/i18n/locales/pt-BR/settings.json +++ b/webview-ui/src/i18n/locales/pt-BR/settings.json @@ -63,6 +63,7 @@ "qdrantUrlLabel": "URL Qdrant", "qdrantKeyLabel": "Chave Qdrant:", "startIndexingButton": "Iniciar", + "resumeIndexingButton": "Resume", "clearIndexDataButton": "Limpar Índice", "unsavedSettingsMessage": "Por favor, salve suas configurações antes de iniciar o processo de indexação.", "clearDataDialog": { diff --git a/webview-ui/src/i18n/locales/ru/settings.json b/webview-ui/src/i18n/locales/ru/settings.json index 5952dd8c89..142c877328 100644 --- a/webview-ui/src/i18n/locales/ru/settings.json +++ b/webview-ui/src/i18n/locales/ru/settings.json @@ -63,6 +63,7 @@ "qdrantUrlLabel": "URL Qdrant", "qdrantKeyLabel": "Ключ Qdrant:", "startIndexingButton": "Начать", + "resumeIndexingButton": "Resume", "clearIndexDataButton": "Очистить индекс", "unsavedSettingsMessage": "Пожалуйста, сохрани настройки перед запуском процесса индексации.", "clearDataDialog": { diff --git a/webview-ui/src/i18n/locales/tr/settings.json b/webview-ui/src/i18n/locales/tr/settings.json index 625ca4d5ea..8c28a27038 100644 --- a/webview-ui/src/i18n/locales/tr/settings.json +++ b/webview-ui/src/i18n/locales/tr/settings.json @@ -63,6 +63,7 @@ "qdrantUrlLabel": "Qdrant URL", "qdrantKeyLabel": "Qdrant Anahtarı:", "startIndexingButton": "Başlat", + "resumeIndexingButton": "Resume", "clearIndexDataButton": "İndeks Temizle", "unsavedSettingsMessage": "İndeksleme işlemini başlatmadan önce lütfen ayarlarını kaydet.", "clearDataDialog": { diff --git a/webview-ui/src/i18n/locales/vi/settings.json b/webview-ui/src/i18n/locales/vi/settings.json index 52a9db5b93..46c51099ab 100644 --- a/webview-ui/src/i18n/locales/vi/settings.json +++ b/webview-ui/src/i18n/locales/vi/settings.json @@ -63,6 +63,7 @@ "qdrantUrlLabel": "URL Qdrant", "qdrantKeyLabel": "Khóa Qdrant:", "startIndexingButton": "Bắt đầu", + "resumeIndexingButton": "Resume", "clearIndexDataButton": "Xóa chỉ mục", "unsavedSettingsMessage": "Vui lòng lưu cài đặt của bạn trước khi bắt đầu quá trình lập chỉ mục.", "clearDataDialog": { diff --git a/webview-ui/src/i18n/locales/zh-CN/settings.json b/webview-ui/src/i18n/locales/zh-CN/settings.json index 151ee9e744..5a4490cc64 100644 --- a/webview-ui/src/i18n/locales/zh-CN/settings.json +++ b/webview-ui/src/i18n/locales/zh-CN/settings.json @@ -74,6 +74,7 @@ "qdrantApiKeyPlaceholder": "输入你的 Qdrant API 密钥(可选)", "setupConfigLabel": "设置", "startIndexingButton": "开始", + "resumeIndexingButton": "恢复", "clearIndexDataButton": "清除索引", "unsavedSettingsMessage": "请先保存设置再开始索引过程。", "clearDataDialog": { diff --git a/webview-ui/src/i18n/locales/zh-TW/settings.json b/webview-ui/src/i18n/locales/zh-TW/settings.json index ab4caeea5b..9ba5c2acd6 100644 --- a/webview-ui/src/i18n/locales/zh-TW/settings.json +++ b/webview-ui/src/i18n/locales/zh-TW/settings.json @@ -63,6 +63,7 @@ "qdrantUrlLabel": "Qdrant URL", "qdrantKeyLabel": "Qdrant 金鑰:", "startIndexingButton": "開始", + "resumeIndexingButton": "Resume", "clearIndexDataButton": "清除索引", "unsavedSettingsMessage": "請先儲存設定再開始索引程序。", "clearDataDialog": {