Skip to content

Setting search#41285

Merged
yeelam-gordon merged 103 commits intomainfrom
dev/vanzue/search
Aug 25, 2025
Merged

Setting search#41285
yeelam-gordon merged 103 commits intomainfrom
dev/vanzue/search

Conversation

@vanzue
Copy link
Contributor

@vanzue vanzue commented Aug 21, 2025

AI summary

This pull request introduces infrastructure and code to support search functionality for PowerToys settings, including a new search index specification, a dedicated search library, and updates to the solution configuration. The main changes are the addition of a spec describing how settings should be indexed and navigated, the creation of a new Common.Search project with a fuzz search implementation, and updates to the solution file to include these new components.

Settings Search Feature Implementation

  • Documentation:

    • Added a detailed specification (settings-search.md) describing the structure of PowerToys settings pages, how to index settings, navigation logic, runtime search, result grouping, build-time indexing strategy, and corner cases.
  • New Search Library:

    • Added the new Common.Search project to the solution, including its project file and implementation of a fuzz search service (FuzzSearchService<T>), match options, match results, and search precision scoring. [1] [2] [3] [4] [5]
  • Solution Configuration:

    • Updated PowerToys.sln to include Common.Search and Settings.UI.XamlIndexBuilder projects, and configured their build. [1] [2] [3] [4]
    • Infrastructure changes to support settings indexing and navigation
    • UI updates to All pages to add search identifiers and convert to a new navigatable page structure
      settings for various platforms and mapped project dependencies.

Spell-check Dictionary Updates

  • Added new terms related to navigation and settings UI components (such as Navigatable, NavigatablePage, settingscard, Tru, tweakable) to the spell-check dictionary to support the new search and indexing features. [1] [2] [3]

Summary of the Pull Request

PR Checklist

  • Closes: #xxx
  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end-user-facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Localized search:
image

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@yeelam-gordon
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yeelam-gordon
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@niels9001 niels9001 self-requested a review August 25, 2025 09:58
@github-actions
Copy link

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

❌ Errors, Warnings, and Notices Count
⚠️ binary-file 4
ℹ️ candidate-pattern 2
❌ forbidden-pattern 1
⚠️ ignored-expect-variant 1
⚠️ no-newline-at-eof 1

See ❌ Event descriptions for more information.

These words are not needed and should be removed advancedpasteui advancedpasteuishortcut age allpc fff hotkeylockmachine hotkeyreconnect hotkeyswitch hotkeytoggleeasymouse imagetotext imagetotextshortcut LOCKMACHINE measuretool mousepointercrosshairs pasteashtmlfile pasteashtmlfileshortcut pasteasjson pasteasjsonshortcut pasteasmarkdown pasteasmarkdownshortcut pasteasplaintext pasteasplaintextshortcut pasteaspngfile pasteaspngfileshortcut pasteastxtfile pasteastxtfileshortcut powerocr reparenthotkey thumbnailhotkey TOGGLEEASYMOUSE transcodetomp Tru

Some files were automatically ignored 🙈

These sample patterns would exclude them:

^\Qsrc/modules/peek/Peek.UITests/TestAssets/4.qoi\E$
^src/modules/powerrename/PowerRenameUITest/testItems/

You should consider adding them to:

.github/actions/spell-check/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To update file exclusions and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the git@github.com:microsoft/PowerToys.git repository
on the dev/vanzue/search branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/c635c2f3f714eec2fcf27b643a1919b9a811ef2e/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/17206497928/attempts/1' &&
git commit -m 'Update check-spelling metadata'
Pattern suggestions ✂️ (2)

You could add these patterns to .github/actions/spell-check/patterns.txt:

# Automatically suggested patterns

# hit-count: 1 file-count: 1
# marker to ignore all code on line
^.*/\* #no-spell-check-line \*/.*$

# hit-count: 1 file-count: 1
# marker to ignore all code on line
^.*\bno-spell-check(?:-line|)(?:\s.*|)$

Alternatively, if a pattern suggestion doesn't make sense for this project, add a #
to the beginning of the line in the candidates file with the pattern to stop suggesting it.

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

@yeelam-gordon
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yeelam-gordon yeelam-gordon merged commit 4ad951e into main Aug 25, 2025
14 checks passed
vanzue added a commit that referenced this pull request Aug 27, 2025
## Summary of the Pull Request

- Renames `NavigatablePage` to `NavigablePage` to fix a spelling error.
- Reverts related entries in `exclude.txt` that triggered a forbidden
pattern error in the spell checker.
- The spell checker does not allow PascalCase words like
`NavigatablePage` in `exclude.txt` because of its automatic casing
rules.

 
Regression: #41285

---------

Co-authored-by: vanzue <vanzue@outlook.com>
@yeelam-gordon yeelam-gordon requested a review from Copilot August 27, 2025 08:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a comprehensive search functionality for PowerToys settings. The implementation adds search infrastructure, a new search library, and updates to the UI to support finding and navigating to specific settings within the PowerToys application.

  • Settings search feature with fuzzy search capabilities and real-time suggestions
  • Infrastructure changes to support settings indexing and navigation
  • UI updates to multiple pages to add search identifiers and convert to a new navigatable page structure

Reviewed Changes

Copilot reviewed 96 out of 99 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/settings-ui/Settings.UI/ViewModels/SuggestionItem.cs New view model for search suggestions with navigation parameters
src/settings-ui/Settings.UI/ViewModels/SearchResultsViewModel.cs View model handling search results display and grouping
src/settings-ui/Settings.UI/ViewModels/ShellViewModel.cs Added navigation item tracking for search functionality
src/settings-ui/Settings.UI/Strings/en-us/Resources.resw Added localized strings for search UI elements
src/settings-ui/Settings.UI/SettingsXAML/Views/ShellPage.xaml.cs Implemented search functionality with debounced text input and result handling
src/settings-ui/Settings.UI/SettingsXAML/Views/ShellPage.xaml Added search box to title bar with suggestion templates
src/settings-ui/Settings.UI/SettingsXAML/Views/SearchResultsPage.xaml.cs New page for displaying full search results
src/settings-ui/Settings.UI/SettingsXAML/Views/SearchResultsPage.xaml UI layout for search results with grouped display
Multiple settings pages (.xaml/.cs) Updated to inherit from NavigatablePage and added Name attributes for searchability

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

// If the token is already canceled before scheduling, the task won't start.
var swSearch = Stopwatch.StartNew();
Logger.LogDebug($"[Search][TextChanged][{traceId}] dispatch search...");
results = await Task.Run(() => SearchIndexService.Search(query, token), token);
Copy link

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using ConfigureAwait(false) for the Task.Run operation to avoid potential deadlocks in UI scenarios.

Suggested change
results = await Task.Run(() => SearchIndexService.Search(query, token), token);
results = await Task.Run(() => SearchIndexService.Search(query, token), token).ConfigureAwait(false);

Copilot uses AI. Check for mistakes.
private List<string> _searchSuggestions = [];

private CancellationTokenSource _searchDebounceCts;
private const int SearchDebounceMs = 500;
Copy link

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider making the search debounce timeout configurable or document why 500ms was chosen as the optimal delay.

Suggested change
private const int SearchDebounceMs = 500;
/// <summary>
/// Gets or sets the search debounce timeout in milliseconds. Default is 500ms.
/// </summary>
public int SearchDebounceMs { get; set; } = 500;

Copilot uses AI. Check for mistakes.
Comment on lines +51 to +53
public void SetSearchResults(string query, List<SettingEntry> results)
{
if (results == null || results.Count == 0)
Copy link

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider making the results parameter nullable or use IEnumerable for better API flexibility.

Suggested change
public void SetSearchResults(string query, List<SettingEntry> results)
{
if (results == null || results.Count == 0)
public void SetSearchResults(string query, IEnumerable<SettingEntry>? results)
{
if (results == null || !results.Any())

Copilot uses AI. Check for mistakes.
@DMPMFSQHFK10
Copy link

AI summary

This pull request introduces infrastructure and code to support search functionality for PowerToys settings, including a new search index specification, a dedicated search library, and updates to the solution configuration. The main changes are the addition of a spec describing how settings should be indexed and navigated, the creation of a new Common.Search project with a fuzz search implementation, and updates to the solution file to include these new components.

Settings Search Feature Implementation

  • Documentation:

    • Added a detailed specification (settings-search.md) describing the structure of PowerToys settings pages, how to index settings, navigation logic, runtime search, result grouping, build-time indexing strategy, and corner cases.
  • New Search Library:

    • Added the new Common.Search project to the solution, including its project file and implementation of a fuzz search service (FuzzSearchService<T>), match options, match results, and search precision scoring. [1] [2] [3] [4] [5]
  • Solution Configuration:

    • Updated PowerToys.sln to include Common.Search and Settings.UI.XamlIndexBuilder projects, and configured their build. [1] [2] [3] [4]
    • Infrastructure changes to support settings indexing and navigation
    • UI updates to All pages to add search identifiers and convert to a new navigatable page structure
      settings for various platforms and mapped project dependencies.

Spell-check Dictionary Updates

  • Added new terms related to navigation and settings UI components (such as Navigatable, NavigatablePage, settingscard, Tru, tweakable) to the spell-check dictionary to support the new search and indexing features. [1] [2] [3]

Summary of the Pull Request

PR Checklist

  • Closes: #xxx

  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected

  • Tests: Added/updated and all pass

  • Localization: All end-user-facing strings can be localized

  • Dev docs: Added/updated

  • New binaries: Added on the required places

  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Localized search: image

Open

@vanzue vanzue deleted the dev/vanzue/search branch November 5, 2025 03:18
carlos-zamora added a commit to microsoft/terminal that referenced this pull request Feb 20, 2026
## 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 microsoft/PowerToys#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.
@microsoft microsoft deleted a comment from juz4jim-gif Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

In for .96 Product-Settings The standalone PowerToys Settings application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants