@@ -480,8 +480,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
480
480
// - <none>
481
481
void Command::ExpandCommands (IMap<winrt::hstring, Model::Command> commands,
482
482
IVectorView<Model::Profile> profiles,
483
- IVectorView<Model::ColorScheme> schemes,
484
- IVector<SettingsLoadWarnings> warnings)
483
+ IVectorView<Model::ColorScheme> schemes)
485
484
{
486
485
std::vector<winrt::hstring> commandsToRemove;
487
486
std::vector<Model::Command> commandsToAdd;
@@ -491,7 +490,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
491
490
{
492
491
auto cmd{ get_self<implementation::Command>(nameAndCmd.Value ()) };
493
492
494
- auto newCommands = _expandCommand (cmd, profiles, schemes, warnings );
493
+ auto newCommands = _expandCommand (cmd, profiles, schemes);
495
494
if (newCommands.size () > 0 )
496
495
{
497
496
commandsToRemove.push_back (nameAndCmd.Key ());
@@ -529,21 +528,18 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
529
528
// Arguments:
530
529
// - expandable: the Command to potentially turn into more commands
531
530
// - profiles: A list of all the profiles that this command should be expanded on.
532
- // - warnings: If there were any warnings during parsing, they'll be
533
- // appended to this vector.
534
531
// Return Value:
535
532
// - and empty vector if the command wasn't expandable, otherwise a list of
536
533
// the newly-created commands.
537
534
std::vector<Model::Command> Command::_expandCommand (Command* const expandable,
538
535
IVectorView<Model::Profile> profiles,
539
- IVectorView<Model::ColorScheme> schemes,
540
- IVector<SettingsLoadWarnings>& warnings)
536
+ IVectorView<Model::ColorScheme> schemes)
541
537
{
542
538
std::vector<Model::Command> newCommands;
543
539
544
540
if (expandable->HasNestedCommands ())
545
541
{
546
- ExpandCommands (expandable->_subcommands , profiles, schemes, warnings );
542
+ ExpandCommands (expandable->_subcommands , profiles, schemes);
547
543
}
548
544
549
545
if (expandable->_IterateOn == ExpandCommandType::None)
@@ -564,18 +560,19 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
564
560
const auto actualDataEnd = newJsonString.data () + newJsonString.size ();
565
561
if (!reader->parse (actualDataStart, actualDataEnd, &newJsonValue, &errs))
566
562
{
567
- warnings.Append (SettingsLoadWarnings::FailedToParseCommandJson);
568
563
// If we encounter a re-parsing error, just stop processing the rest of the commands.
569
564
return false ;
570
565
}
571
566
572
567
// Pass the new json back though FromJson, to get the new expanded value.
573
- std::vector<SettingsLoadWarnings> newWarnings;
574
- if (auto newCmd{ Command::FromJson (newJsonValue, newWarnings) })
568
+ // FromJson requires that we pass in a vector to hang on to the
569
+ // warnings, but ultimately, we don't care about warnings during
570
+ // expansion.
571
+ std::vector<SettingsLoadWarnings> unused;
572
+ if (auto newCmd{ Command::FromJson (newJsonValue, unused) })
575
573
{
576
574
newCommands.push_back (*newCmd);
577
575
}
578
- std::for_each (newWarnings.begin (), newWarnings.end (), [warnings](auto & warn) { warnings.Append (warn); });
579
576
return true ;
580
577
};
581
578
0 commit comments