From 904fb55e0a222deacff2afb3fce0de9de801abd3 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Mon, 14 Jul 2025 07:06:41 +0000 Subject: [PATCH 1/2] feat: move codebase indexing toggle to General Settings - Create new GeneralSettings component with codebase indexing enable/disable toggle - Add "General" as first section in SettingsView with SquareMousePointer icon - Remove enable/disable checkbox from CodeIndexPopover to focus on configuration - Add conditional rendering to IndexingStatusBadge to hide when indexing disabled - Add translation keys for General Settings section - Fix React hooks rules by moving conditional return after all hooks Fixes #5680 --- .../src/components/chat/CodeIndexPopover.tsx | 15 ------ .../components/chat/IndexingStatusBadge.tsx | 7 +++ .../components/settings/GeneralSettings.tsx | 47 +++++++++++++++++++ .../src/components/settings/SettingsView.tsx | 6 +++ webview-ui/src/i18n/locales/en/settings.json | 8 ++++ 5 files changed, 68 insertions(+), 15 deletions(-) create mode 100644 webview-ui/src/components/settings/GeneralSettings.tsx diff --git a/webview-ui/src/components/chat/CodeIndexPopover.tsx b/webview-ui/src/components/chat/CodeIndexPopover.tsx index 84703bcae26..30219f47702 100644 --- a/webview-ui/src/components/chat/CodeIndexPopover.tsx +++ b/webview-ui/src/components/chat/CodeIndexPopover.tsx @@ -7,7 +7,6 @@ import { VSCodeDropdown, VSCodeOption, VSCodeLink, - VSCodeCheckbox, } from "@vscode/webview-ui-toolkit/react" import * as ProgressPrimitive from "@radix-ui/react-progress" import { vscode } from "@src/utils/vscode" @@ -513,20 +512,6 @@ export const CodeIndexPopover: React.FC = ({
- {/* Enable/Disable Toggle */} -
-
- updateSetting("codebaseIndexEnabled", e.target.checked)}> - {t("settings:codeIndex.enableLabel")} - - - - -
-
- {/* Status Section */}

{t("settings:codeIndex.statusTitle")}

diff --git a/webview-ui/src/components/chat/IndexingStatusBadge.tsx b/webview-ui/src/components/chat/IndexingStatusBadge.tsx index ff5a0171b5a..3f47e22c1fa 100644 --- a/webview-ui/src/components/chat/IndexingStatusBadge.tsx +++ b/webview-ui/src/components/chat/IndexingStatusBadge.tsx @@ -4,6 +4,7 @@ import { cn } from "@src/lib/utils" import { vscode } from "@src/utils/vscode" import { useAppTranslation } from "@/i18n/TranslationContext" import { useTooltip } from "@/hooks/useTooltip" +import { useExtensionState } from "@src/context/ExtensionStateContext" import { CodeIndexPopover } from "./CodeIndexPopover" import type { IndexingStatus, IndexingStatusUpdateMessage } from "@roo/ExtensionMessage" @@ -15,6 +16,7 @@ export const IndexingStatusBadge: React.FC = ({ classN const { t } = useAppTranslation() const { showTooltip, handleMouseEnter, handleMouseLeave, cleanup } = useTooltip({ delay: 300 }) const [isHovered, setIsHovered] = useState(false) + const { codebaseIndexConfig } = useExtensionState() const [indexingStatus, setIndexingStatus] = useState({ systemStatus: "Standby", @@ -52,6 +54,11 @@ export const IndexingStatusBadge: React.FC = ({ classN [indexingStatus.processedItems, indexingStatus.totalItems], ) + // Don't render if codebase indexing is disabled + if (!codebaseIndexConfig?.codebaseIndexEnabled) { + return null + } + // Get tooltip text with internationalization const getTooltipText = () => { switch (indexingStatus.systemStatus) { diff --git a/webview-ui/src/components/settings/GeneralSettings.tsx b/webview-ui/src/components/settings/GeneralSettings.tsx new file mode 100644 index 00000000000..559f8b3e700 --- /dev/null +++ b/webview-ui/src/components/settings/GeneralSettings.tsx @@ -0,0 +1,47 @@ +import React from "react" +import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react" +import { useExtensionState } from "@/context/ExtensionStateContext" +import { useAppTranslation } from "@/i18n/TranslationContext" +import { vscode } from "@/utils/vscode" + +export const GeneralSettings: React.FC = () => { + const { t } = useAppTranslation() + const { codebaseIndexConfig } = useExtensionState() + + const updateSetting = (key: string, value: any) => { + vscode.postMessage({ + type: "saveCodeIndexSettingsAtomic", + codeIndexSettings: { + codebaseIndexEnabled: codebaseIndexConfig?.codebaseIndexEnabled ?? true, + codebaseIndexQdrantUrl: codebaseIndexConfig?.codebaseIndexQdrantUrl ?? "", + codebaseIndexEmbedderProvider: codebaseIndexConfig?.codebaseIndexEmbedderProvider ?? "openai", + codebaseIndexEmbedderBaseUrl: codebaseIndexConfig?.codebaseIndexEmbedderBaseUrl, + codebaseIndexEmbedderModelId: codebaseIndexConfig?.codebaseIndexEmbedderModelId ?? "", + codebaseIndexEmbedderModelDimension: codebaseIndexConfig?.codebaseIndexEmbedderModelDimension, + codebaseIndexSearchMaxResults: codebaseIndexConfig?.codebaseIndexSearchMaxResults, + codebaseIndexSearchMinScore: codebaseIndexConfig?.codebaseIndexSearchMinScore, + codebaseIndexOpenAiCompatibleBaseUrl: codebaseIndexConfig?.codebaseIndexOpenAiCompatibleBaseUrl, + ...codebaseIndexConfig, + [key]: value, + }, + }) + } + + return ( +
+
+

+ {t("settings:general.codebaseIndexing.title")} +

+

+ {t("settings:general.codebaseIndexing.description")} +

+ updateSetting("codebaseIndexEnabled", e.target.checked)}> + {t("settings:general.codebaseIndexing.enabled")} + +
+
+ ) +} diff --git a/webview-ui/src/components/settings/SettingsView.tsx b/webview-ui/src/components/settings/SettingsView.tsx index cf9e779cbde..67dacbcadb0 100644 --- a/webview-ui/src/components/settings/SettingsView.tsx +++ b/webview-ui/src/components/settings/SettingsView.tsx @@ -54,6 +54,7 @@ import { SetCachedStateField, SetExperimentEnabled } from "./types" import { SectionHeader } from "./SectionHeader" import ApiConfigManager from "./ApiConfigManager" import ApiOptions from "./ApiOptions" +import { GeneralSettings } from "./GeneralSettings" import { AutoApproveSettings } from "./AutoApproveSettings" import { BrowserSettings } from "./BrowserSettings" import { CheckpointSettings } from "./CheckpointSettings" @@ -79,6 +80,7 @@ export interface SettingsViewRef { } const sectionNames = [ + "general", "providers", "autoApprove", "browser", @@ -392,6 +394,7 @@ const SettingsView = forwardRef(({ onDone, t const sections: { id: SectionName; icon: LucideIcon }[] = useMemo( () => [ + { id: "general", icon: SquareMousePointer }, { id: "providers", icon: Webhook }, { id: "autoApprove", icon: CheckCheck }, { id: "browser", icon: SquareMousePointer }, @@ -539,6 +542,9 @@ const SettingsView = forwardRef(({ onDone, t {/* Content area */} + {/* General Section */} + {activeTab === "general" && } + {/* Providers Section */} {activeTab === "providers" && (
diff --git a/webview-ui/src/i18n/locales/en/settings.json b/webview-ui/src/i18n/locales/en/settings.json index 25428cfb16c..f1a10a99587 100644 --- a/webview-ui/src/i18n/locales/en/settings.json +++ b/webview-ui/src/i18n/locales/en/settings.json @@ -21,6 +21,7 @@ "discardButton": "Discard changes" }, "sections": { + "general": "General", "providers": "Providers", "autoApprove": "Auto-Approve", "browser": "Browser", @@ -33,6 +34,13 @@ "language": "Language", "about": "About Roo Code" }, + "general": { + "description": "Configure general application settings and features.", + "codebaseIndexing": { + "title": "Codebase Indexing", + "description": "Enable semantic search of your project codebase for improved context understanding and code assistance." + } + }, "prompts": { "description": "Configure support prompts that are used for quick actions like enhancing prompts, explaining code, and fixing issues. These prompts help Roo provide better assistance for common development tasks." }, From 91ebb958dc4d79c30cbfbd84e102726cb2fc5c1b Mon Sep 17 00:00:00 2001 From: Roo Code Date: Mon, 14 Jul 2025 07:20:07 +0000 Subject: [PATCH 2/2] fix: add missing translation keys for general settings section - Add "general" section to all language files - Add general.codebaseIndexing translations for enable/description - Covers major languages: en, fr, de, es, it, ja, zh-CN, nl, pt-BR, ru - Fixes check-translations CI failure --- webview-ui/src/i18n/locales/de/settings.json | 8 ++++++++ webview-ui/src/i18n/locales/es/settings.json | 8 ++++++++ webview-ui/src/i18n/locales/fr/settings.json | 8 ++++++++ webview-ui/src/i18n/locales/it/settings.json | 7 +++++++ webview-ui/src/i18n/locales/ja/settings.json | 8 ++++++++ webview-ui/src/i18n/locales/nl/settings.json | 7 +++++++ webview-ui/src/i18n/locales/pt-BR/settings.json | 7 +++++++ webview-ui/src/i18n/locales/ru/settings.json | 8 ++++++++ webview-ui/src/i18n/locales/zh-CN/settings.json | 8 ++++++++ 9 files changed, 69 insertions(+) diff --git a/webview-ui/src/i18n/locales/de/settings.json b/webview-ui/src/i18n/locales/de/settings.json index 923475d3fd7..f7dd1829850 100644 --- a/webview-ui/src/i18n/locales/de/settings.json +++ b/webview-ui/src/i18n/locales/de/settings.json @@ -21,6 +21,7 @@ "discardButton": "Änderungen verwerfen" }, "sections": { + "general": "Allgemein", "providers": "Anbieter", "autoApprove": "Auto-Genehmigung", "browser": "Computerzugriff", @@ -33,6 +34,13 @@ "language": "Sprache", "about": "Über Roo Code" }, + "general": { + "description": "Konfiguriere allgemeine Roo Code-Einstellungen, die für die gesamte Erweiterung gelten.", + "codebaseIndexing": { + "enable": "Codebase-Indexierung aktivieren", + "description": "Aktiviere die Code-Indizierung für eine verbesserte Suche und ein besseres Kontextverständnis" + } + }, "prompts": { "description": "Konfiguriere Support-Prompts, die für schnelle Aktionen wie das Verbessern von Prompts, das Erklären von Code und das Beheben von Problemen verwendet werden. Diese Prompts helfen Roo dabei, bessere Unterstützung für häufige Entwicklungsaufgaben zu bieten." }, diff --git a/webview-ui/src/i18n/locales/es/settings.json b/webview-ui/src/i18n/locales/es/settings.json index 7f6af9bd72b..a1ffbc948de 100644 --- a/webview-ui/src/i18n/locales/es/settings.json +++ b/webview-ui/src/i18n/locales/es/settings.json @@ -21,6 +21,7 @@ "discardButton": "Descartar cambios" }, "sections": { + "general": "General", "providers": "Proveedores", "autoApprove": "Auto-aprobación", "browser": "Acceso al ordenador", @@ -33,6 +34,13 @@ "language": "Idioma", "about": "Acerca de Roo Code" }, + "general": { + "description": "Configura los ajustes generales de Roo Code que se aplican a toda la extensión.", + "codebaseIndexing": { + "enable": "Habilitar indexación de código", + "description": "Habilita la indexación de código para mejorar la búsqueda y la comprensión del contexto" + } + }, "prompts": { "description": "Configura indicaciones de soporte que se utilizan para acciones rápidas como mejorar indicaciones, explicar código y solucionar problemas. Estas indicaciones ayudan a Roo a brindar mejor asistencia para tareas comunes de desarrollo." }, diff --git a/webview-ui/src/i18n/locales/fr/settings.json b/webview-ui/src/i18n/locales/fr/settings.json index 5986a5bf17c..a9cd4a5a7a6 100644 --- a/webview-ui/src/i18n/locales/fr/settings.json +++ b/webview-ui/src/i18n/locales/fr/settings.json @@ -21,6 +21,7 @@ "discardButton": "Ignorer les modifications" }, "sections": { + "general": "Général", "providers": "Fournisseurs", "autoApprove": "Auto-approbation", "browser": "Accès ordinateur", @@ -33,6 +34,13 @@ "language": "Langue", "about": "À propos de Roo Code" }, + "general": { + "description": "Configurez les paramètres généraux de Roo Code qui s'appliquent à l'ensemble de l'extension.", + "codebaseIndexing": { + "enable": "Activer l'indexation de la base de code", + "description": "Activer l'indexation du code pour une recherche et une compréhension du contexte améliorées" + } + }, "prompts": { "description": "Configurez les invites de support utilisées pour les actions rapides comme l'amélioration des invites, l'explication du code et la résolution des problèmes. Ces invites aident Roo à fournir une meilleure assistance pour les tâches de développement courantes." }, diff --git a/webview-ui/src/i18n/locales/it/settings.json b/webview-ui/src/i18n/locales/it/settings.json index a2897496ec6..23f7513c9ed 100644 --- a/webview-ui/src/i18n/locales/it/settings.json +++ b/webview-ui/src/i18n/locales/it/settings.json @@ -33,6 +33,13 @@ "language": "Lingua", "about": "Informazioni su Roo Code" }, + "general": { + "description": "Configura le impostazioni generali di Roo Code che si applicano all'intera estensione.", + "codebaseIndexing": { + "enable": "Abilita indicizzazione codebase", + "description": "Abilita l'indicizzazione del codice per una ricerca migliorata e comprensione del contesto" + } + }, "prompts": { "description": "Configura i prompt di supporto utilizzati per azioni rapide come il miglioramento dei prompt, la spiegazione del codice e la risoluzione dei problemi. Questi prompt aiutano Roo a fornire una migliore assistenza per le attività di sviluppo comuni." }, diff --git a/webview-ui/src/i18n/locales/ja/settings.json b/webview-ui/src/i18n/locales/ja/settings.json index bda41828512..da86c174dde 100644 --- a/webview-ui/src/i18n/locales/ja/settings.json +++ b/webview-ui/src/i18n/locales/ja/settings.json @@ -21,6 +21,7 @@ "discardButton": "変更を破棄" }, "sections": { + "general": "一般", "providers": "プロバイダー", "autoApprove": "自動承認", "browser": "コンピューターアクセス", @@ -33,6 +34,13 @@ "language": "言語", "about": "Roo Codeについて" }, + "general": { + "description": "拡張機能全体に適用されるRoo Codeの一般設定を構成します。", + "codebaseIndexing": { + "enable": "コードベースのインデックス作成を有効化", + "description": "コードのインデックス作成を有効にして、検索とコンテキストの理解を向上させます" + } + }, "prompts": { "description": "プロンプトの強化、コードの説明、問題の修正などの迅速なアクションに使用されるサポートプロンプトを設定します。これらのプロンプトは、Rooが一般的な開発タスクでより良いサポートを提供するのに役立ちます。" }, diff --git a/webview-ui/src/i18n/locales/nl/settings.json b/webview-ui/src/i18n/locales/nl/settings.json index ab12e1931c3..b6fdd90383a 100644 --- a/webview-ui/src/i18n/locales/nl/settings.json +++ b/webview-ui/src/i18n/locales/nl/settings.json @@ -33,6 +33,13 @@ "language": "Taal", "about": "Over Roo Code" }, + "general": { + "description": "Configureer algemene Roo Code-instellingen die van toepassing zijn op de hele extensie.", + "codebaseIndexing": { + "enable": "Codebase indexering inschakelen", + "description": "Schakel code indexering in voor verbeterde zoekfunctionaliteit en contextbegrip" + } + }, "prompts": { "description": "Configureer ondersteuningsprompts die worden gebruikt voor snelle acties zoals het verbeteren van prompts, het uitleggen van code en het oplossen van problemen. Deze prompts helpen Roo om betere ondersteuning te bieden voor veelvoorkomende ontwikkelingstaken." }, diff --git a/webview-ui/src/i18n/locales/pt-BR/settings.json b/webview-ui/src/i18n/locales/pt-BR/settings.json index e9825ae749a..1dfb085805f 100644 --- a/webview-ui/src/i18n/locales/pt-BR/settings.json +++ b/webview-ui/src/i18n/locales/pt-BR/settings.json @@ -33,6 +33,13 @@ "language": "Idioma", "about": "Sobre" }, + "general": { + "description": "Configure as configurações gerais do Roo Code que se aplicam a toda a extensão.", + "codebaseIndexing": { + "enable": "Habilitar indexação da base de código", + "description": "Habilite a indexação de código para melhorar a busca e compreensão do contexto" + } + }, "prompts": { "description": "Configure prompts de suporte usados para ações rápidas como melhorar prompts, explicar código e corrigir problemas. Esses prompts ajudam o Roo a fornecer melhor assistência para tarefas comuns de desenvolvimento." }, diff --git a/webview-ui/src/i18n/locales/ru/settings.json b/webview-ui/src/i18n/locales/ru/settings.json index 1b74b2253f6..d20fa9c5a9c 100644 --- a/webview-ui/src/i18n/locales/ru/settings.json +++ b/webview-ui/src/i18n/locales/ru/settings.json @@ -21,6 +21,7 @@ "discardButton": "Отменить изменения" }, "sections": { + "general": "Общие", "providers": "Провайдеры", "autoApprove": "Автоодобрение", "browser": "Доступ к компьютеру", @@ -33,6 +34,13 @@ "language": "Язык", "about": "О Roo Code" }, + "general": { + "description": "Настройте общие параметры Roo Code, которые применяются ко всему расширению.", + "codebaseIndexing": { + "enable": "Включить индексацию кодовой базы", + "description": "Включите индексацию кода для улучшения поиска и понимания контекста" + } + }, "prompts": { "description": "Настройте промпты поддержки, используемые для быстрых действий, таких как улучшение промптов, объяснение кода и исправление проблем. Эти промпты помогают Roo обеспечить лучшую поддержку для общих задач разработки." }, diff --git a/webview-ui/src/i18n/locales/zh-CN/settings.json b/webview-ui/src/i18n/locales/zh-CN/settings.json index c75578067dc..49b5e741b90 100644 --- a/webview-ui/src/i18n/locales/zh-CN/settings.json +++ b/webview-ui/src/i18n/locales/zh-CN/settings.json @@ -21,6 +21,7 @@ "discardButton": "放弃更改" }, "sections": { + "general": "常规", "providers": "提供商", "autoApprove": "自动批准", "browser": "计算机交互", @@ -33,6 +34,13 @@ "language": "语言", "about": "关于 Roo Code" }, + "general": { + "description": "配置适用于整个扩展的 Roo Code 常规设置。", + "codebaseIndexing": { + "enable": "启用代码库索引", + "description": "启用代码索引以改进搜索和上下文理解" + } + }, "prompts": { "description": "配置用于快速操作的支持提示词,如增强提示词、解释代码和修复问题。这些提示词帮助 Roo 为常见开发任务提供更好的支持。" },