Fix default formatting for deserialized MatchInfo (#11728)
MatchInfo class has ToEmphasizedString() member method to color output line. In remote scenario MatchInfo class is deserialized as Deserialized.Microsoft.PowerShell.Commands.MatchInfo without the method. As result default formating in remote scenario show nothing. The fix is to directly output Line property.
This commit is contained in:
parent
8ebff6a2a4
commit
43e0e1a1c5
|
@ -46,6 +46,10 @@ namespace System.Management.Automation.Runspaces
|
|||
"Microsoft.PowerShell.Commands.MatchInfo",
|
||||
ViewsOf_Microsoft_PowerShell_Commands_MatchInfo());
|
||||
|
||||
yield return new ExtendedTypeDefinition(
|
||||
"Deserialized.Microsoft.PowerShell.Commands.MatchInfo",
|
||||
ViewsOf_Deserialized_Microsoft_PowerShell_Commands_MatchInfo());
|
||||
|
||||
yield return new ExtendedTypeDefinition(
|
||||
"System.Management.Automation.PSVariable",
|
||||
ViewsOf_System_Management_Automation_PSVariable());
|
||||
|
@ -382,6 +386,16 @@ namespace System.Management.Automation.Runspaces
|
|||
.EndControl());
|
||||
}
|
||||
|
||||
private static IEnumerable<FormatViewDefinition> ViewsOf_Deserialized_Microsoft_PowerShell_Commands_MatchInfo()
|
||||
{
|
||||
yield return new FormatViewDefinition("MatchInfo",
|
||||
CustomControl.Create()
|
||||
.StartEntry()
|
||||
.AddScriptBlockExpressionBinding(@"$_.Line")
|
||||
.EndEntry()
|
||||
.EndControl());
|
||||
}
|
||||
|
||||
private static IEnumerable<FormatViewDefinition> ViewsOf_System_Management_Automation_PSVariable()
|
||||
{
|
||||
yield return new FormatViewDefinition("Variable",
|
||||
|
|
Loading…
Reference in a new issue