Skip evaluating suggestions at startup (#18232)

This commit is contained in:
Dongbo Wang authored and GitHub committed 2022-10-07 23:07:56 +05:00
1 parent 667e75559d
commit bcde806724
1 file changed
+5 -4
@@ -2465,14 +2465,15 @@ namespace Microsoft.PowerShell
/// </summary>
internal void Run(bool inputLoopIsNested)
{
System.Management.Automation.Host.PSHostUserInterface c = _parent.UI;
PSHostUserInterface c = _parent.UI;
ConsoleHostUserInterface ui = c as ConsoleHostUserInterface;
Dbg.Assert(ui != null, "Host.UI should return an instance.");
bool inBlockMode = false;
bool previousResponseWasEmpty = false;
StringBuilder inputBlock = new StringBuilder();
// Use nullable so that we don't evaluate suggestions at startup.
bool? previousResponseWasEmpty = null;
var inputBlock = new StringBuilder();
while (!_parent.ShouldEndSession && !_shouldExit)
{
@@ -2499,7 +2500,7 @@ namespace Microsoft.PowerShell
ui.WriteLine();
// Evaluate any suggestions
if (!previousResponseWasEmpty)
if (previousResponseWasEmpty == false)
{
EvaluateSuggestions(ui);
}