Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
@check-spelling-bot Report🔴 Please reviewSee the 📂 files view, the 📜action log, or 📝 job summary for details.
See ❌ Event descriptions for more information. These words are not needed and should be removedadvancedpasteui 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 TruSome files were automatically ignored 🙈These sample patterns would exclude them: You should consider adding them to: 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 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 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 Alternatively, if a pattern suggestion doesn't make sense for this project, add a If the flagged items are 🤯 false positivesIf items relate to a ...
|
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
## 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>
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Consider using ConfigureAwait(false) for the Task.Run operation to avoid potential deadlocks in UI scenarios.
| results = await Task.Run(() => SearchIndexService.Search(query, token), token); | |
| results = await Task.Run(() => SearchIndexService.Search(query, token), token).ConfigureAwait(false); |
| private List<string> _searchSuggestions = []; | ||
|
|
||
| private CancellationTokenSource _searchDebounceCts; | ||
| private const int SearchDebounceMs = 500; |
There was a problem hiding this comment.
[nitpick] Consider making the search debounce timeout configurable or document why 500ms was chosen as the optimal delay.
| 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; |
| public void SetSearchResults(string query, List<SettingEntry> results) | ||
| { | ||
| if (results == null || results.Count == 0) |
There was a problem hiding this comment.
[nitpick] Consider making the results parameter nullable or use IEnumerable for better API flexibility.
| 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()) |
Open |
## 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.

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.Searchproject with a fuzz search implementation, and updates to the solution file to include these new components.Settings Search Feature Implementation
Documentation:
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:
Common.Searchproject 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:
PowerToys.slnto includeCommon.SearchandSettings.UI.XamlIndexBuilderprojects, and configured their build. [1] [2] [3] [4]settings for various platforms and mapped project dependencies.
Spell-check Dictionary Updates
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
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
Localized search:
