Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 1 addition & 46 deletions src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2565,14 +2565,7 @@ internal void Run(bool inputLoopIsNested)
// Evaluate any suggestions
if (previousResponseWasEmpty == false)
{
if (ExperimentalFeature.IsEnabled(ExperimentalFeature.PSFeedbackProvider))
{
EvaluateFeedbacks(ui);
}
else
{
EvaluateSuggestions(ui);
}
EvaluateFeedbacks(ui);
}

// Then output the prompt
Expand Down Expand Up @@ -2896,44 +2889,6 @@ private void EvaluateFeedbacks(ConsoleHostUserInterface ui)
}
}

private void EvaluateSuggestions(ConsoleHostUserInterface ui)
{
// Output any training suggestions
try
{
List<string> suggestions = HostUtilities.GetSuggestion(_parent.Runspace);

if (suggestions.Count > 0)
{
ui.WriteLine();
}

bool first = true;
foreach (string suggestion in suggestions)
{
if (!first)
ui.WriteLine();

ui.WriteLine(suggestion);

first = false;
}
}
catch (TerminateException)
{
// A variable breakpoint may be hit by HostUtilities.GetSuggestion. The debugger throws TerminateExceptions to stop the execution
// of the current statement; we do not want to treat these exceptions as errors.
}
catch (Exception e)
{
// Catch-all OK. This is a third-party call-out.
ui.WriteErrorLine(e.Message);

LocalRunspace localRunspace = (LocalRunspace)_parent.Runspace;
localRunspace.GetExecutionContext.AppendDollarError(e);
}
}

private string EvaluatePrompt()
{
string promptString = _promptExec.ExecuteCommandAndGetResultAsString("prompt", out _);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
Expand All @@ -21,7 +20,6 @@ public class ExperimentalFeature
#region Const Members

internal const string EngineSource = "PSEngine";
internal const string PSFeedbackProvider = "PSFeedbackProvider";
internal const string PSSerializeJSONLongEnumAsNumber = nameof(PSSerializeJSONLongEnumAsNumber);
internal const string PSProfileDSCResource = "PSProfileDSCResource";

Expand Down Expand Up @@ -109,9 +107,6 @@ static ExperimentalFeature()
new ExperimentalFeature(
name: "PSLoadAssemblyFromNativeCode",
description: "Expose an API to allow assembly loading from native code"),
new ExperimentalFeature(
name: PSFeedbackProvider,
description: "Replace the hard-coded suggestion framework with the extensible feedback provider"),
new ExperimentalFeature(
name: PSSerializeJSONLongEnumAsNumber,
description: "Serialize enums based on long or ulong as an numeric value rather than the string representation when using ConvertTo-Json."
Expand Down
Loading
Loading