From fc3639dd0380e16c0dc62f83619d7b84956e834f Mon Sep 17 00:00:00 2001 From: Patrick Meinecke Date: Mon, 2 May 2022 12:59:02 -0400 Subject: [PATCH] Add `IHostUISupportsMultipleChoiceSelection` impl Without this, `InternalHostUserInterface` will try to emulate support, leading to different runtime behavior. --- .../Host/EditorServicesConsolePSHostUserInterface.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHostUserInterface.cs b/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHostUserInterface.cs index 06fa4a74b..fb6d2c861 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHostUserInterface.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Host/EditorServicesConsolePSHostUserInterface.cs @@ -12,7 +12,7 @@ namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Host { - internal class EditorServicesConsolePSHostUserInterface : PSHostUserInterface + internal class EditorServicesConsolePSHostUserInterface : PSHostUserInterface, IHostUISupportsMultipleChoiceSelection { private readonly PSHostUserInterface _underlyingHostUI; @@ -90,5 +90,12 @@ public void ResetProgress() public override void WriteVerboseLine(string message) => _underlyingHostUI.WriteVerboseLine(message); public override void WriteWarningLine(string message) => _underlyingHostUI.WriteWarningLine(message); + + public Collection PromptForChoice( + string caption, + string message, + Collection choices, + IEnumerable defaultChoices) + => ((IHostUISupportsMultipleChoiceSelection)_underlyingHostUI).PromptForChoice(caption, message, choices, defaultChoices); } }