diff --git a/webview-ui/src/components/settings/SettingsView.tsx b/webview-ui/src/components/settings/SettingsView.tsx index 4f7499a1b1..d86007e80f 100644 --- a/webview-ui/src/components/settings/SettingsView.tsx +++ b/webview-ui/src/components/settings/SettingsView.tsx @@ -588,18 +588,33 @@ const SettingsView = forwardRef(({ onDone, t const initialTab = useRef(activeTab) const isIndexing = indexingTabIndex < sectionNames.length const isIndexingComplete = !isIndexing + const tabTitlesRegistered = useRef(false) // Index all tabs by cycling through them on mount useLayoutEffect(() => { if (indexingTabIndex >= sectionNames.length) { - // All tabs indexed, return to initial tab - setActiveTab(initialTab.current) + // All tabs indexed, now register tab titles as searchable items + if (!tabTitlesRegistered.current && searchContextValue) { + sections.forEach(({ id }) => { + const tabTitle = t(`settings:sections.${id}`) + // Register each tab title as a searchable item + // Using a special naming convention for tab titles: "tab-{sectionName}" + searchContextValue.registerSetting({ + settingId: `tab-${id}`, + section: id, + label: tabTitle, + }) + }) + tabTitlesRegistered.current = true + // Return to initial tab + setActiveTab(initialTab.current) + } return } // Move to the next tab on next render setIndexingTabIndex((prev) => prev + 1) - }, [indexingTabIndex]) + }, [indexingTabIndex, searchContextValue, sections, t]) // Determine which tab content to render (for indexing or active display) const renderTab = isIndexing ? sectionNames[indexingTabIndex] : activeTab