Skip to content

Commit bcde806

Browse files
authored
Skip evaluating suggestions at startup (PowerShell#18232)
1 parent 667e755 commit bcde806

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2465,14 +2465,15 @@ private void HandleRunspacePopped(object sender, EventArgs eventArgs)
24652465
/// </summary>
24662466
internal void Run(bool inputLoopIsNested)
24672467
{
2468-
System.Management.Automation.Host.PSHostUserInterface c = _parent.UI;
2468+
PSHostUserInterface c = _parent.UI;
24692469
ConsoleHostUserInterface ui = c as ConsoleHostUserInterface;
24702470

24712471
Dbg.Assert(ui != null, "Host.UI should return an instance.");
24722472

24732473
bool inBlockMode = false;
2474-
bool previousResponseWasEmpty = false;
2475-
StringBuilder inputBlock = new StringBuilder();
2474+
// Use nullable so that we don't evaluate suggestions at startup.
2475+
bool? previousResponseWasEmpty = null;
2476+
var inputBlock = new StringBuilder();
24762477

24772478
while (!_parent.ShouldEndSession && !_shouldExit)
24782479
{
@@ -2499,7 +2500,7 @@ internal void Run(bool inputLoopIsNested)
24992500
ui.WriteLine();
25002501

25012502
// Evaluate any suggestions
2502-
if (!previousResponseWasEmpty)
2503+
if (previousResponseWasEmpty == false)
25032504
{
25042505
EvaluateSuggestions(ui);
25052506
}

0 commit comments

Comments
 (0)