Files
terminal/tools/GenerateSettingsIndex.ps1

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

451 lines
17 KiB
PowerShell
Raw Normal View History

Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
<#
Copyright (c) Microsoft Corporation.
Licensed under the MIT license.
.SYNOPSIS
Scans XAML files for local:SettingsCard and local:SettingsExpander entries and generates GeneratedSettingsIndex.g.h / .g.cpp.
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
.PARAMETER SourceDir
Directory to scan recursively for .xaml files.
.PARAMETER OutputDir
Directory to place generated C++ files.
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$false)][string]$SourceDir = "$PSScriptRoot\..\src\cascadia\TerminalSettingsEditor\",
[Parameter(Mandatory=$false)][string]$OutputDir = "$PSScriptRoot\..\src\cascadia\TerminalSettingsEditor\Generated Files\"
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
)
# Prohibited UIDs (exact match, case-insensitive by default)
$ProhibitedUids = @(
"Extensions_Scope",
"Profile_MissingFontFaces",
"Profile_ProportionalFontFaces",
"ColorScheme_InboxSchemeDuplicate",
"ColorScheme_ColorsHeader",
"ColorScheme_Rename",
"Profile_ResetProfile",
"Profile_DeleteProfile"
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
)
# Prohibited XAML files (already limited to Page root elements)
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
$ProhibitedXamlFiles = @(
"AISettings.xaml",
"Profiles_Base_Orphaned.xaml",
"EditAction.xaml",
"MainPage.xaml"
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
)
# Grouped metadata for each page class
$ClassMap = @{
"Microsoft::Terminal::Settings::Editor::Launch" = @{
ResourceName = "Nav_Launch/Content"
NavigationParam = "Launch_Nav"
SubPage = "BreadcrumbSubPage::None"
}
"Microsoft::Terminal::Settings::Editor::Interaction" = @{
ResourceName = "Nav_Interaction/Content"
NavigationParam = "Interaction_Nav"
SubPage = "BreadcrumbSubPage::None"
}
"Microsoft::Terminal::Settings::Editor::GlobalAppearance" = @{
ResourceName = "Nav_Appearance/Content"
NavigationParam = "GlobalAppearance_Nav"
SubPage = "BreadcrumbSubPage::None"
}
"Microsoft::Terminal::Settings::Editor::ColorSchemes" = @{
ResourceName = "Nav_ColorSchemes/Content"
NavigationParam = "ColorSchemes_Nav"
SubPage = "BreadcrumbSubPage::None"
}
"Microsoft::Terminal::Settings::Editor::Rendering" = @{
ResourceName = "Nav_Rendering/Content"
NavigationParam = "Rendering_Nav"
SubPage = "BreadcrumbSubPage::None"
}
"Microsoft::Terminal::Settings::Editor::Compatibility" = @{
ResourceName = "Nav_Compatibility/Content"
NavigationParam = "Compatibility_Nav"
SubPage = "BreadcrumbSubPage::None"
}
"Microsoft::Terminal::Settings::Editor::Actions" = @{
ResourceName = "Nav_Actions/Content"
NavigationParam = "Actions_Nav"
SubPage = "BreadcrumbSubPage::None"
}
"Microsoft::Terminal::Settings::Editor::NewTabMenu" = @{
ResourceName = "Nav_NewTabMenu/Content" # [Folders] Replaced with folder name
NavigationParam = "NewTabMenu_Nav" # [Folders] Replaced with folder VM
SubPage = "BreadcrumbSubPage::None" # [Folders] Replaced with BreadcrumbSubPage::NewTabMenu_Folder
}
"Microsoft::Terminal::Settings::Editor::Extensions" = @{
ResourceName = "Nav_Extensions/Content" # [Extension] Replaced with extension name
NavigationParam = "Extensions_Nav" # [Extension] Replaced with extension VM
SubPage = "BreadcrumbSubPage::None" # [Extension] Replaced with BreadcrumbSubPage::Extensions_Extension
}
"Microsoft::Terminal::Settings::Editor::Profiles_Base" = @{
ResourceName = "Nav_ProfileDefaults/Content"
NavigationParam = "GlobalProfile_Nav"
SubPage = "BreadcrumbSubPage::None"
}
"Microsoft::Terminal::Settings::Editor::Profiles_Appearance" = @{
ResourceName = "Nav_ProfileDefaults/Content"
NavigationParam = "GlobalProfile_Nav"
SubPage = "BreadcrumbSubPage::Profile_Appearance"
}
"Microsoft::Terminal::Settings::Editor::Profiles_Terminal" = @{
ResourceName = "Nav_ProfileDefaults/Content"
NavigationParam = "GlobalProfile_Nav"
SubPage = "BreadcrumbSubPage::Profile_Terminal"
}
"Microsoft::Terminal::Settings::Editor::Profiles_Advanced" = @{
ResourceName = "Nav_ProfileDefaults/Content"
NavigationParam = "GlobalProfile_Nav"
SubPage = "BreadcrumbSubPage::Profile_Advanced"
}
2026-06-11 18:25:31 -07:00
"Microsoft::Terminal::Settings::Editor::Profiles" = @{
ResourceName = "Nav_Profiles/Content"
NavigationParam = "Profiles_Nav"
SubPage = "BreadcrumbSubPage::None"
}
}
function IsProfileSubPage($pageClass)
{
return $pageClass -match "Editor::Profiles_Appearance" -or
$pageClass -match "Editor::Profiles_Terminal" -or
$pageClass -match "Editor::Profiles_Advanced"
}
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
if (-not (Test-Path $SourceDir)) { throw "SourceDir not found: $SourceDir" }
if (-not (Test-Path $OutputDir)) { New-Item -ItemType Directory -Path $OutputDir | Out-Null }
$entries = @()
foreach ($xamlFile in Get-ChildItem -Path $SourceDir -Filter *.xaml)
{
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
# Skip whole file if prohibited
$filename = $xamlFile.Name
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
if ($ProhibitedXamlFiles -contains $filename)
{
continue
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
}
# Load XAML and namespace manager
[xml]$xml = Get-Content -LiteralPath $xamlFile.FullName
$xm = New-Object System.Xml.XmlNamespaceManager($xml.NameTable)
$xm.AddNamespace("local", "using:Microsoft.Terminal.Settings.Editor")
$xm.AddNamespace("x", "http://schemas.microsoft.com/winfx/2006/xaml")
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
if ($xml.DocumentElement.LocalName -ne "Page" -and $filename -ne "Appearances.xaml")
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
{
# Only allow xaml files for Page elements (or Appearances.xaml)
continue
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
}
# Extract Page x:Class
# Appearances.xaml: UserControl hosted in Profiles_Appearance.xaml
$pageClass = $filename -eq "Appearances.xaml" ?
"Microsoft::Terminal::Settings::Editor::Profiles_Appearance" :
$xml.DocumentElement.SelectSingleNode("@x:Class", $xm).Value
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
# Convert XAML namespace dots to C++ scope operators
$pageClass = ($pageClass -replace "\.", "::")
if ($ClassMap.ContainsKey(($pageClass)) -and -not (IsProfileSubPage $pageClass))
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
{
$entries += [pscustomobject]@{
ResourceName = $ClassMap[$pageClass].ResourceName
ParentPage = $pageClass
NavigationParam = $ClassMap[$pageClass].NavigationParam
SubPage = $ClassMap[$pageClass].SubPage
ElementName = $null # No specific element to navigate to, for the page itself
File = $filename
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
}
}
elseif ($pageClass -notmatch "Editor::EditColorScheme" -and -not (IsProfileSubPage $pageClass))
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
{
# Special case: EditColorScheme is only valid if a color scheme is associated,
# so don't register it in ClassMap and don't skip over it here.
Write-Warning "No class map entry for page class $pageClass (file: $filename). Skipping automatic index generation for this page."
continue
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
}
# Manually register special entries
if ($filename -eq "ColorSchemes.xaml")
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
{
# "add new" button
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
$entries += [pscustomobject]@{
ResourceName = "ColorScheme_AddNewButton/Text"
ParentPage = $pageClass
NavigationParam = $ClassMap[$pageClass].NavigationParam
SubPage = $ClassMap[$pageClass].SubPage
ElementName = "AddNewButton"
File = $filename
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
}
}
# Iterate over all local:SettingsCard and local:SettingsExpander nodes
foreach ($settingContainer in ($xml.SelectNodes("//local:SettingsCard", $xm) + $xml.SelectNodes("//local:SettingsExpander", $xm)))
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
{
# Extract Uid
if ($null -eq $settingContainer.Uid)
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
{
# SettingsCard/SettingsExpander without x:Uid are not indexable — skip silently
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
continue
}
elseif ($ProhibitedUids -contains $settingContainer.Uid)
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
{
continue
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
}
Fix GenerateSettingsIndex using element name instead of x:Name (#19945) Use GetAttribute('x:Name') instead of .Name in GenerateSettingsIndex.ps1 to avoid PowerShell's XML integration returning the element tag name (e.g. 'local:SettingContainer') when x:Name is absent. Also add missing x:Name attributes to: - Compatibility.xaml: AmbiguousWidth SettingContainer - NewTabMenu.xaml: AddRemainingProfiles and CurrentFolderIcon containers ## Summary of the Pull Request Fix GenerateSettingsIndex.ps1 emitting "local:SettingContainer" as the element name in the generated index when a SettingContainer has no x:Name attribute. ## References and Relevant Issues Per DHowett's comment - the root cause is PowerShell's XML integration: $element.Name returns the XML element tag name (e.g. local:SettingContainer) when no x:Name attribute exists. ## Detailed Description of the Pull Request / Additional comments Two changes: - GenerateSettingsIndex.ps1: Replace $settingContainer.Name with $settingContainer.GetAttribute("x:Name"), which correctly returns an empty string when the attribute is absent instead of the element tag name. - Add missing x:Name attributes to three SettingContainer elements: - Compatibility.xaml: AmbiguousWidth (Globals_AmbiguousWidth) - NewTabMenu.xaml: AddRemainingProfiles (NewTabMenu_AddRemainingProfiles) - NewTabMenu.xaml: CurrentFolderIcon (NewTabMenu_CurrentFolderIcon) - This fixes four incorrect IndexEntry lines in the generated output that previously contained L"local:SettingContainer" as the element name. ## Validation Steps Performed Ran GenerateSettingsIndex.ps1 before and after - confirmed the four incorrect entries with L"local:SettingContainer" are now generated with the correct x:Name values (or empty string where appropriate). ## PR Checklist Closes #19929 Co-authored-by: Sagar Bhure <sagarbhure@microsoft.com>
2026-03-10 22:33:15 +05:30
# Extract Name via GetAttribute to avoid PowerShell's XML integration
2026-06-09 17:14:56 -07:00
# returning the element name (e.g. "local:SettingsCard") when x:Name is absent.
Fix GenerateSettingsIndex using element name instead of x:Name (#19945) Use GetAttribute('x:Name') instead of .Name in GenerateSettingsIndex.ps1 to avoid PowerShell's XML integration returning the element tag name (e.g. 'local:SettingContainer') when x:Name is absent. Also add missing x:Name attributes to: - Compatibility.xaml: AmbiguousWidth SettingContainer - NewTabMenu.xaml: AddRemainingProfiles and CurrentFolderIcon containers ## Summary of the Pull Request Fix GenerateSettingsIndex.ps1 emitting "local:SettingContainer" as the element name in the generated index when a SettingContainer has no x:Name attribute. ## References and Relevant Issues Per DHowett's comment - the root cause is PowerShell's XML integration: $element.Name returns the XML element tag name (e.g. local:SettingContainer) when no x:Name attribute exists. ## Detailed Description of the Pull Request / Additional comments Two changes: - GenerateSettingsIndex.ps1: Replace $settingContainer.Name with $settingContainer.GetAttribute("x:Name"), which correctly returns an empty string when the attribute is absent instead of the element tag name. - Add missing x:Name attributes to three SettingContainer elements: - Compatibility.xaml: AmbiguousWidth (Globals_AmbiguousWidth) - NewTabMenu.xaml: AddRemainingProfiles (NewTabMenu_AddRemainingProfiles) - NewTabMenu.xaml: CurrentFolderIcon (NewTabMenu_CurrentFolderIcon) - This fixes four incorrect IndexEntry lines in the generated output that previously contained L"local:SettingContainer" as the element name. ## Validation Steps Performed Ran GenerateSettingsIndex.ps1 before and after - confirmed the four incorrect entries with L"local:SettingContainer" are now generated with the correct x:Name values (or empty string where appropriate). ## PR Checklist Closes #19929 Co-authored-by: Sagar Bhure <sagarbhure@microsoft.com>
2026-03-10 22:33:15 +05:30
$name = $settingContainer.GetAttribute("x:Name")
if ([string]::IsNullOrEmpty($name))
{
$name = ""
}
if ($filename -eq "Appearances.xaml")
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
{
# Profile.Appearance settings need a special prefix for the ElementName.
# This allows us to bring the element into view at runtime.
$name = "App." + $name
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
}
# Deduce NavigationParam and SubPage
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
# includeInBuildIndex: include the entry in the build-time index (no special param at runtime)
# includeInPartialIndex: include the entry in the partial index, where the NavigationParam is the view model at runtime (i.e. profile vs profile defaults)
$includeInBuildIndex = $true
$includeInPartialIndex = $false
$navigationParam = $ClassMap[$pageClass].NavigationParam
$subPage = $ClassMap[$pageClass].SubPage ?? "BreadcrumbSubPage::None"
if ($pageClass -match "Editor::NewTabMenu")
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
{
if ($settingContainer.Uid -match "NewTabMenu_CurrentFolder")
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
{
$navigationParam = $null # VM param at runtime
$subPage = "BreadcrumbSubPage::NewTabMenu_Folder"
$includeInBuildIndex = $false
$includeInPartialIndex = $true
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
}
else
{
$includeInPartialIndex = $true
}
}
elseif ($pageClass -match "Editor::Profiles_Base" -or (IsProfileSubPage $pageClass))
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
{
$includeInBuildIndex = !($name -eq "Name" -or $name -eq "Commandline")
$includeInPartialIndex = $true
}
elseif ($pageClass -match "Editor::EditColorScheme")
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
{
$subPage = "BreadcrumbSubPage::ColorSchemes_Edit"
$includeInBuildIndex = $false
$includeInPartialIndex = $true
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
}
if ($includeInBuildIndex)
{
$entries += [pscustomobject]@{
ResourceName = "$($settingContainer.Uid)/Header"
ParentPage = $pageClass
NavigationParam = $navigationParam
SubPage = $subPage
ElementName = $name
File = $filename
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
}
}
if ($includeInPartialIndex)
{
$entries += [pscustomobject]@{
ResourceName = "$($settingContainer.Uid)/Header"
ParentPage = $pageClass
NavigationParam = $null # VM param at runtime
SubPage = $pageClass -match "Editor::NewTabMenu" ? "BreadcrumbSubPage::NewTabMenu_Folder" : $subPage
ElementName = $name
File = $filename
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
}
}
}
}
function FormatEntry($e)
{
$formattedResourceName = 'USES_RESOURCE(L"{0}")' -f $e.ResourceName
$formattedNavigationParam = 'L"{0}"' -f $e.NavigationParam # null Navigation param resolves to empty string
$formattedElementName = 'L"{0}"' -f $e.ElementName
return " IndexEntry{{ {0}, {1}, {2}, {3} }}, // {4}" -f ($formattedResourceName, $formattedNavigationParam, $e.SubPage, $formattedElementName, $e.File)
}
function FormatEntries($es) {
return ($es | ForEach-Object { FormatEntry $_ }) -join "`r`n"
}
# Sort and remove duplicates
$entries = $entries | Sort-Object ResourceName, ParentPage, NavigationParam, SubPage, ElementName, File -Unique
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
$buildTimeEntries = @()
$profileEntries = @()
$schemeEntries = @()
$ntmEntries = @()
foreach ($e in $entries)
{
if ($null -eq $e.NavigationParam -and $e.ParentPage -match "Profiles_")
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
{
$profileEntries += $e
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
}
elseif ($e.SubPage -eq "BreadcrumbSubPage::ColorSchemes_Edit")
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
{
$schemeEntries += $e
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
}
elseif ($e.SubPage -eq "BreadcrumbSubPage::NewTabMenu_Folder")
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
{
$ntmEntries += $e
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
}
else
{
$buildTimeEntries += $e
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
}
}
$headerPath = Join-Path $OutputDir "GeneratedSettingsIndex.g.h"
$cppPath = Join-Path $OutputDir "GeneratedSettingsIndex.g.cpp"
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
$header = @"
/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
--*/
// This file is automatically generated by tools\GenerateSettingsIndex.ps1. Changes to this file may be overwritten.
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
#pragma once
#include <winrt/Windows.UI.Xaml.Interop.h>
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
struct IndexEntry
{
// Resource name of the SettingContainer's Header (i.e. "Globals_DefaultProfile/Header")
// NOTE: wrapped in USES_RESOURCE() to take advantage of compile-time resource name validation in ResourceLoader
wil::zwstring_view ResourceName;
// Navigation argument
// - the tag used to identify the page to navigate to (i.e. "Launch_Nav")
// - empty if the NavigationArg is meant to be a view model object at runtime (i.e. profile, ntm folder, etc.)
wil::zwstring_view NavigationArgTag;
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
// SubPage to navigate to, for pages with multiple subpages (i.e. Profiles, New Tab Menu)
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
BreadcrumbSubPage SubPage;
// x:Name of the SettingContainer to navigate to on the page (i.e. "DefaultProfile")
wil::zwstring_view ElementName;
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
};
const std::array<IndexEntry, $($buildTimeEntries.Count)>& LoadBuildTimeIndex();
const std::array<IndexEntry, $($profileEntries.Count)>& LoadProfileIndex();
const std::array<IndexEntry, $($ntmEntries.Count)>& LoadNTMFolderIndex();
const std::array<IndexEntry, $($schemeEntries.Count)>& LoadColorSchemeIndex();
const IndexEntry& PartialProfileIndexEntry();
const IndexEntry& PartialNTMFolderIndexEntry();
const IndexEntry& PartialColorSchemeIndexEntry();
const IndexEntry& PartialExtensionIndexEntry();
const IndexEntry& PartialActionIndexEntry();
}
"@
$cpp = @"
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// This file is automatically generated by tools\GenerateSettingsIndex.ps1. Changes to this file may be overwritten.
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
#include "pch.h"
#include <winrt/Microsoft.Terminal.Settings.Editor.h>
#include "GeneratedSettingsIndex.g.h"
#include <LibraryResources.h>
// In Debug builds, USES_RESOURCE() expands to a lambda (for resource validation),
// which prevents constexpr evaluation. In Release it's a no-op identity macro.
#ifdef _DEBUG
#define STATIC_INDEX_QUALIFIER static const
#else
#define STATIC_INDEX_QUALIFIER static constexpr
#endif
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
const std::array<IndexEntry, $($buildTimeEntries.Count)>& LoadBuildTimeIndex()
{
STATIC_INDEX_QUALIFIER std::array entries =
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
{
$(FormatEntries $buildTimeEntries)
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
};
return entries;
}
const std::array<IndexEntry, $($profileEntries.Count)>& LoadProfileIndex()
{
STATIC_INDEX_QUALIFIER std::array entries =
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
{
$(FormatEntries $profileEntries)
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
};
return entries;
}
const std::array<IndexEntry, $($ntmEntries.Count)>& LoadNTMFolderIndex()
{
STATIC_INDEX_QUALIFIER std::array entries =
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
{
$(FormatEntries $ntmEntries)
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
};
return entries;
}
const std::array<IndexEntry, $($schemeEntries.Count)>& LoadColorSchemeIndex()
{
STATIC_INDEX_QUALIFIER std::array entries =
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
{
$(FormatEntries $schemeEntries)
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
};
return entries;
}
const IndexEntry& PartialProfileIndexEntry()
{
static constexpr IndexEntry entry{ .SubPage = BreadcrumbSubPage::None };
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
return entry;
}
const IndexEntry& PartialNTMFolderIndexEntry()
{
static constexpr IndexEntry entry{ .SubPage = BreadcrumbSubPage::NewTabMenu_Folder };
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
return entry;
}
const IndexEntry& PartialColorSchemeIndexEntry()
{
static constexpr IndexEntry entry{ .SubPage = BreadcrumbSubPage::ColorSchemes_Edit };
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
return entry;
}
const IndexEntry& PartialExtensionIndexEntry()
{
static constexpr IndexEntry entry{ .SubPage = BreadcrumbSubPage::Extensions_Extension };
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
return entry;
}
const IndexEntry& PartialActionIndexEntry()
{
static constexpr IndexEntry entry{ .SubPage = BreadcrumbSubPage::Actions_Edit };
Implement search in Settings UI (#19519) ## Summary of the Pull Request Adds search functionality to the settings UI. This is added to an `AutoSuggestBox` in the main `NavigationView`. Invoking a result navigates to the proper location in the settings UI and focuses the setting, when possible. ## References and Relevant Issues Based on https://github.com/microsoft/PowerToys/pull/41285 ## Detailed Description of the Pull Request / Additional comments - tools/GenerateSettingsIndex.ps1: parses all the XAML files in the settings UI for SettingsContainers and builds a search index from them - XAML changes: ensures all SettingContainer objects have an `x:Name` so that we can navigate to them and bring them into view. - TerminalSettingsEditor/Utils.h: implements `BringIntoViewWhenLoaded()` which navigates to the relevant part of the UI. This is called in `OnNavigatedTo()` for each page. - fzf was moved out of TerminalApp so that TerminalSettingsEditor can access it - There's a few main components to searching, all of it is in `MainPage`: - `MainPage::_UpdateSearchIndex()`|`SearchIndex::Reset()`: loads the search index generated by `GenerateSettingsIndex.ps1`; provides additional localization, if needed - `MainPage::SettingsSearchBox_TextChanged`: - detect that text changed in the search box - perform the actual search in `SearchIndex::SearchAsync()`. This is a HEFTY async function that can be cancelled. It needs a lot of context passed in to expand the search index appropriately (i.e. build awareness of "PowerShell" profile and generate results appropriately). This is also where fzf is used to perform weighted matching. - the weighted matching itself is pretty complicated, but all the associated bonus weights are at the top of SearchIndex.cpp. - `SettingsSearchBox_QuerySubmitted`: extract the search index metadata and call the correct `_Navigate()` function ## Validation Steps Performed Search for... - settings that don't change at runtime: - [x] global settings - [x] settings in profile.defaults - [x] "add new profile" page - settings that may change at runtime: - [x] settings in a profile - [x] individual color schemes - [x] actions (main actions page + edit action subpage) - [x] new tab menu folders - [x] extensions - misc. corner cases: - [x] terminal chat (blocked in indexing script; requires minor changes in feature branch) - [x] settings in appearance objects To test fzf matching and weighted results, I specifically tested these scenarios: - "PowerShell" --> prioritize the PowerShell profile page(s) - "font size" --> prioritize profile defaults entry - "font size powershell" --> prioritize PowerShell > font size ## PR Checklist Closes #12949 ## Follow-ups - search by JSON key: need a way to add JSON keys to index entries. `GetSearchableFields()` should make the rest pretty easy. - search by keywords: need to define keywords. `GetSearchableFields()` should make the rest pretty easy.
2026-02-20 15:04:45 -08:00
return entry;
}
}
"@
Set-Content -LiteralPath $headerPath -Value $header -NoNewline
Set-Content -LiteralPath $cppPath -Value $cpp -NoNewline
Write-Host "Generated:"
Write-Host " $headerPath"
Write-Host " $cppPath"