mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-10 18:43:54 -06:00
improve index
This commit is contained in:
parent
e56eb74788
commit
2a41f8a57c
@ -1074,6 +1074,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
co_await winrt::resume_foreground(Dispatcher());
|
||||
if (searchGeneration != _filteredSearchIndex.generation())
|
||||
{
|
||||
// TODO CARLOS: look into til::throttled_func (winrt version and non-winrt version) for debounce (used in BellSound and TaskbarProgressUpdates)
|
||||
// search index was updated while we were searching, discard results
|
||||
co_return;
|
||||
}
|
||||
@ -1104,7 +1105,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{ \
|
||||
if (til::contains_linguistic_insensitive(runtimeObjectIdentifier, sanitizedQuery)) \
|
||||
{ \
|
||||
/*results.push_back(winrt::make<FilteredSearchResult>(, profile));*/ \
|
||||
/*results.push_back(winrt::make<FilteredSearchResult>(<NEED ANOTHER PARAM>, runtimeObj, runtimeObjectIdentifier));*/ \
|
||||
} \
|
||||
\
|
||||
for (const auto* indexEntry : filteredSearchIndex) \
|
||||
@ -1122,7 +1123,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
// TODO CARLOS: if name matches, link the top-level page
|
||||
// can't do that rn because I need a LocalizedIndexEntry stored somewhere for that
|
||||
//results.push_back(winrt::make<FilteredSearchResult>(, profile));
|
||||
// SPECIFICALLY, I NEED TO CONVERT PartialProfileIndexEntry into a LocalizedIndexEntry (which is dumb, because there's nothing to localize)
|
||||
//results.push_back(winrt::make<FilteredSearchResult>(&PartialProfileIndexEntry(), profile));//, std::optional<hstring>{ profile.Name() }));
|
||||
}
|
||||
|
||||
for (const auto* indexEntry : _filteredSearchProfileIndex)
|
||||
|
||||
@ -42,9 +42,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
FilteredSearchResult(const winrt::hstring& label) :
|
||||
_overrideLabel{ label } {}
|
||||
|
||||
FilteredSearchResult(const LocalizedIndexEntry* entry, const Windows::Foundation::IInspectable& navigationArgOverride = nullptr) :
|
||||
FilteredSearchResult(const LocalizedIndexEntry* entry, const Windows::Foundation::IInspectable& navigationArgOverride = nullptr, const std::optional<hstring>& label = std::nullopt) :
|
||||
_SearchIndexEntry{ entry },
|
||||
_NavigationArgOverride{ navigationArgOverride } {}
|
||||
_NavigationArgOverride{ navigationArgOverride },
|
||||
_overrideLabel{ label } {}
|
||||
|
||||
hstring ToString() { return Label(); }
|
||||
|
||||
|
||||
@ -93,58 +93,126 @@ Get-ChildItem -Path $SourceDir -Recurse -Filter *.xaml | ForEach-Object {
|
||||
$subPage += 'None'
|
||||
}
|
||||
|
||||
if ($filename -eq 'ColorSchemes.xaml')
|
||||
# Register top-level pages
|
||||
if ($filename -eq 'Launch.xaml')
|
||||
{
|
||||
# ColorSchemes.xaml doesn't have any SettingContainers!
|
||||
$entries += [pscustomobject]@{
|
||||
DisplayTextLocalized = "RS_(L`"Nav_Launch/Content`")"
|
||||
HelpTextLocalized = "std::nullopt"
|
||||
ParentPage = "winrt::xaml_typename<$($pageClass)>()"
|
||||
NavigationParam = "winrt::box_value(hstring{L`"Launch_Nav`"})"
|
||||
SubPage = "BreadcrumbSubPage::None"
|
||||
ElementName = 'L""'
|
||||
File = $filename
|
||||
}
|
||||
}
|
||||
elseif ($filename -eq 'Interaction.xaml')
|
||||
{
|
||||
$entries += [pscustomobject]@{
|
||||
DisplayTextLocalized = "RS_(L`"Nav_Interaction/Content`")"
|
||||
HelpTextLocalized = "std::nullopt"
|
||||
ParentPage = "winrt::xaml_typename<$($pageClass)>()"
|
||||
NavigationParam = "winrt::box_value(hstring{L`"Interaction_Nav`"})"
|
||||
SubPage = "BreadcrumbSubPage::None"
|
||||
ElementName = 'L""'
|
||||
File = $filename
|
||||
}
|
||||
}
|
||||
elseif ($filename -eq 'GlobalAppearance.xaml')
|
||||
{
|
||||
$entries += [pscustomobject]@{
|
||||
DisplayTextLocalized = "RS_(L`"Nav_Appearance/Content`")"
|
||||
HelpTextLocalized = "std::nullopt"
|
||||
ParentPage = "winrt::xaml_typename<$($pageClass)>()"
|
||||
NavigationParam = "winrt::box_value(hstring{L`"Appearance_Nav`"})"
|
||||
SubPage = "BreadcrumbSubPage::None"
|
||||
ElementName = 'L""'
|
||||
File = $filename
|
||||
}
|
||||
}
|
||||
elseif ($filename -eq 'ColorSchemes.xaml')
|
||||
{
|
||||
$entries += [pscustomobject]@{
|
||||
DisplayTextLocalized = "RS_(L`"Nav_ColorSchemes/Content`")"
|
||||
HelpTextLocalized = "std::nullopt"
|
||||
ParentPage = "winrt::xaml_typename<$($pageClass)>()"
|
||||
NavigationParam = "winrt::box_value(hstring{L`"ColorSchemes_Nav`"})"
|
||||
SubPage = "BreadcrumbSubPage::None"
|
||||
ElementName = 'L""'
|
||||
File = $filename
|
||||
}
|
||||
|
||||
# TODO CARLOS: remove from script; hard code in MainPage instead
|
||||
# Register the page itself
|
||||
# $entries += [pscustomobject]@{
|
||||
# DisplayText = 'vm'
|
||||
# ParentPage = "winrt::xaml_typename<Microsoft::Terminal::Settings::Editor::ColorSchemes>()"
|
||||
# NavigationParam = "winrt::box_value(hstring{L`"ColorSchemes_Nav`"})"
|
||||
# SubPage = 'BreadcrumbSubPage::ColorSchemes_Edit'
|
||||
# ElementName = 'L""'
|
||||
# File = $filename
|
||||
# }
|
||||
|
||||
# TODO CARLOS: remove from script; hard code in MainPage instead
|
||||
# Manually register the "add new" button
|
||||
# $entries += [pscustomobject]@{
|
||||
# DisplayText = 'RS_(L"ColorScheme_AddNewButton/Text")'
|
||||
# ParentPage = "winrt::xaml_typename<Microsoft::Terminal::Settings::Editor::ColorSchemes>()"
|
||||
# NavigationParam = "winrt::box_value(hstring{L`"ColorSchemes_Nav`"})"
|
||||
# SubPage = 'BreadcrumbSubPage::None'
|
||||
# ElementName = 'L"AddNewButton"'
|
||||
# File = $filename
|
||||
# }
|
||||
return
|
||||
$entries += [pscustomobject]@{
|
||||
DisplayTextLocalized = 'RS_(L"ColorScheme_AddNewButton/Text")'
|
||||
HelpTextLocalized = 'std::nullopt'
|
||||
ParentPage = "winrt::xaml_typename<$($pageClass)>()"
|
||||
NavigationParam = "winrt::box_value(hstring{L`"ColorSchemes_Nav`"})"
|
||||
SubPage = 'BreadcrumbSubPage::None'
|
||||
ElementName = 'L"AddNewButton"'
|
||||
File = $filename
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($filename -eq 'Rendering.xaml')
|
||||
{
|
||||
$entries += [pscustomobject]@{
|
||||
DisplayTextLocalized = "RS_(L`"Nav_Rendering/Content`")"
|
||||
HelpTextLocalized = "std::nullopt"
|
||||
ParentPage = "winrt::xaml_typename<$($pageClass)>()"
|
||||
NavigationParam = "winrt::box_value(hstring{L`"Rendering_Nav`"})"
|
||||
SubPage = "BreadcrumbSubPage::None"
|
||||
ElementName = 'L""'
|
||||
File = $filename
|
||||
}
|
||||
}
|
||||
elseif ($filename -eq 'Compatibility.xaml')
|
||||
{
|
||||
$entries += [pscustomobject]@{
|
||||
DisplayTextLocalized = "RS_(L`"Nav_Compatibility/Content`")"
|
||||
HelpTextLocalized = "std::nullopt"
|
||||
ParentPage = "winrt::xaml_typename<$($pageClass)>()"
|
||||
NavigationParam = "winrt::box_value(hstring{L`"Compatibility_Nav`"})"
|
||||
SubPage = "BreadcrumbSubPage::None"
|
||||
ElementName = 'L""'
|
||||
File = $filename
|
||||
}
|
||||
}
|
||||
elseif ($filename -eq 'Actions.xaml')
|
||||
{
|
||||
$entries += [pscustomobject]@{
|
||||
DisplayTextLocalized = "RS_(L`"Nav_Actions/Content`")"
|
||||
HelpTextLocalized = "std::nullopt"
|
||||
ParentPage = "winrt::xaml_typename<$($pageClass)>()"
|
||||
NavigationParam = "winrt::box_value(hstring{L`"Actions_Nav`"})"
|
||||
SubPage = "BreadcrumbSubPage::None"
|
||||
ElementName = 'L""'
|
||||
File = $filename
|
||||
}
|
||||
}
|
||||
elseif ($filename -eq 'NewTabMenu.xaml')
|
||||
{
|
||||
$entries += [pscustomobject]@{
|
||||
DisplayTextLocalized = "RS_(L`"Nav_NewTabMenu/Content`")"
|
||||
HelpTextLocalized = "std::nullopt"
|
||||
ParentPage = "winrt::xaml_typename<$($pageClass)>()"
|
||||
NavigationParam = "winrt::box_value(hstring{L`"NewTabMenu_Nav`"})"
|
||||
SubPage = "BreadcrumbSubPage::None"
|
||||
ElementName = 'L""'
|
||||
File = $filename
|
||||
}
|
||||
}
|
||||
elseif ($filename -eq 'Extensions.xaml')
|
||||
{
|
||||
|
||||
# TODO CARLOS: remove from script; hard code in MainPage instead
|
||||
# Register the main extension page
|
||||
# $entries += [pscustomobject]@{
|
||||
# DisplayText = 'RS_(L"Nav_Extensions/Content")'
|
||||
# ParentPage = "winrt::xaml_typename<Microsoft::Terminal::Settings::Editor::Extensions>()"
|
||||
# NavigationParam = "nullptr"
|
||||
# SubPage = 'BreadcrumbSubPage::None'
|
||||
# ElementName = 'L""'
|
||||
# File = $filename
|
||||
# }
|
||||
|
||||
# TODO CARLOS: remove from script; hard code in MainPage instead
|
||||
# Register the extension view
|
||||
# $entries += [pscustomobject]@{
|
||||
# DisplayText = 'vm.Package().DisplayName()'
|
||||
# ParentPage = "winrt::xaml_typename<Microsoft::Terminal::Settings::Editor::Extensions>()"
|
||||
# NavigationParam = "vm"
|
||||
# SubPage = 'BreadcrumbSubPage::Extensions_Extension'
|
||||
# ElementName = 'L""'
|
||||
# File = $filename
|
||||
# }
|
||||
return
|
||||
$entries += [pscustomobject]@{
|
||||
DisplayTextLocalized = "RS_(L`"Nav_Extensions/Content`")"
|
||||
HelpTextLocalized = "std::nullopt"
|
||||
ParentPage = "winrt::xaml_typename<$($pageClass)>()"
|
||||
NavigationParam = "winrt::box_value(hstring{L`"Extensions_Nav`"})"
|
||||
SubPage = "BreadcrumbSubPage::None"
|
||||
ElementName = 'L""'
|
||||
File = $filename
|
||||
}
|
||||
}
|
||||
|
||||
# Find all local:SettingContainer start tags
|
||||
@ -286,7 +354,7 @@ Get-ChildItem -Path $SourceDir -Recurse -Filter *.xaml | ForEach-Object {
|
||||
}
|
||||
|
||||
# Ensure there aren't any duplicate entries
|
||||
$entries = $entries | Sort-Object RootUid, ParentPage, NavigationParam, SubPage, ElementName, File -Unique
|
||||
$entries = $entries | Sort-Object DisplayTextLocalized, HelpTextLocalized, ParentPage, NavigationParam, SubPage, ElementName, File -Unique
|
||||
|
||||
$buildTimeEntries = @()
|
||||
$profileEntries = @()
|
||||
@ -340,6 +408,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
// May not exist for all entries
|
||||
std::optional<hstring> HelpTextLocalized;
|
||||
|
||||
// TODO CARLOS: this might not be necessary; remove
|
||||
// x:Class of the parent Page (i.e. winrt::xaml_typename<Microsoft::Terminal::Settings::Editor::Launch>())
|
||||
winrt::Windows::UI::Xaml::Interop::TypeName ParentPage;
|
||||
|
||||
@ -357,6 +426,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
const std::array<IndexEntry, $($profileEntries.Count)>& LoadProfileIndex();
|
||||
const std::array<IndexEntry, $($ntmEntries.Count)>& LoadNTMFolderIndex();
|
||||
const std::array<IndexEntry, $($schemeEntries.Count)>& LoadColorSchemeIndex();
|
||||
|
||||
const IndexEntry& PartialProfileIndexEntry();
|
||||
}
|
||||
"@
|
||||
|
||||
@ -406,6 +477,12 @@ $( ($schemeEntries -join "`r`n") )
|
||||
};
|
||||
return entries;
|
||||
}
|
||||
|
||||
const IndexEntry& PartialProfileIndexEntry()
|
||||
{
|
||||
static IndexEntry entry{ L"", std::nullopt, winrt::xaml_typename<Microsoft::Terminal::Settings::Editor::Profiles_Base>(), nullptr, BreadcrumbSubPage::None, L"" };
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
"@
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user