Skip to content

Conversation

@carlos-zamora
Copy link
Member

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.
  • There's a few main components to searching, all of it is in MainPage:
    • _UpdateSearchIndex: loads the search index generated by GenerateSettingsIndex.ps1; provides additional localization, if needed
    • SettingsSearchBox_TextChanged:
      • detect that text changed in the search box
      • filter the search index using _QuerySearchIndex()
      • package the results into WinRT objects to then display in the UI
    • 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:
    • global settings
    • settings in profile.defaults
    • "add new profile" page
  • settings that may change at runtime:
    • settings in a profile
    • individual color schemes
    • actions
    • new tab menu folders
    • extensions
  • misc. corner cases:
    • terminal chat
    • settings in appearance objects

PR Checklist

Closes #12949

Follow-ups

These are some additional features that may be added as a part of this PR or as a follow-up:

  • add differentiator for profile results (probably include the profile name in the result UI)
  • add icons to search results (use runtime object icon (i.e. profile icon), fall back to NavViewItem icon)
  • fuzzy search

- SearchMetadata is unsused, but it is designed to hold information
   so that we can navigate to a setting
- Updated all pages to...
   - have an x:Name on relevant setting containers
   - have a NavigateToXArgs used in the OnNavigatedTo() function
   - update the NavigateToXArgs to include the name of an element
      to scroll down to
   - Add BringIntoViewWhenLoaded() to HasScrollViewer<T> which
      scrolls down to the element with a given name
These components aren't fully hooked up together yet and there's a
few TODO CARLOS's throughout. Main upcoming work:
- indexing
- runtime indexing
- search box UI
- search results UI
based on https://github.com/microsoft/PowerToys/blob/079c69b8beced55211485c352f41308426930e47/doc/specs/settings-search.md
- Adds referential XAML names to components of interest.
- Adds a script that generates the build time entries to be loaded
- Invokes the script in Editor.vcxproj
static const std::wstring_view globalAppearanceTag{ L"GlobalAppearance_Nav" };

// Like RS_, but uses an ambient context to determine whether
// to load the English verion of a resource or the localized one.

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

verion is not a recognized word. (unrecognized-spelling)
[Parameter(Mandatory=$false)][string]$OutputDir='D:\projects\terminal\src\cascadia\TerminalSettingsEditor\Generated Files\'
)

# Prohibited UIDs (exact match, case-insensitive by default)

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

UIDs is not a recognized word. (unrecognized-spelling)
)

# Prohibited UIDs (exact match, case-insensitive by default)
$ProhibitedUids = @(

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

Uids is not a recognized word. (unrecognized-spelling)
}
elseif ($filename -eq 'Appearances.xaml')
{
# Apperances.xaml is a UserControl that is hosted in Profiles_Appearance.xaml

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

Apperances is not a recognized word. (unrecognized-spelling)
$uid = $matches[1]

# Skip entry if UID prohibited
if ($ProhibitedUids -contains $uid)

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

Uids is not a recognized word. (unrecognized-spelling)
}
elseif ($pageClass -match 'Editor::Extensions')
{
# TODO CARLOS: There's actually no UIDs for extension view! But I want the page to still exist in the index at runtime for each extension.

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

UIDs is not a recognized word. (unrecognized-spelling)
@microsoft-github-policy-service microsoft-github-policy-service bot added Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Area-SettingsUI Anything specific to the SUI Product-Terminal The new Windows Terminal. labels Nov 4, 2025
@github-actions
Copy link

github-actions bot commented Nov 4, 2025

@check-spelling-bot Report

🔴 Please review

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

Unrecognized words (3)

Apperances
uids
verion

To accept these unrecognized words as correct, you could run the following commands

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

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.25/apply.pl' |
perl - 'https://github.com/microsoft/terminal/actions/runs/19054742436/attempts/1' &&
git commit -m 'Update check-spelling metadata'
Warnings ⚠️ (1)

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

⚠️ Warnings Count
⚠️ ignored-expect-variant 1

See ⚠️ Event descriptions for more information.

✏️ Contributor please read this

By default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.

If the listed items are:

  • ... misspelled, then please correct them instead of using the command.
  • ... names, please add them to .github/actions/spelling/allow/names.txt.
  • ... APIs, you can add them to a file in .github/actions/spelling/allow/.
  • ... just things you're using, please add them to an appropriate file in .github/actions/spelling/expect/.
  • ... tokens you only need in one place and shouldn't generally be used, you can add an item in an appropriate file in .github/actions/spelling/patterns/.

See the README.md in each directory for more information.

🔬 You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. 😉

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-SettingsUI Anything specific to the SUI Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search bar for Settings UI

2 participants