Skip to content

Commit eda7e4a

Browse files
authored
Make the experimental feature PSFeedbackProvider stable (#26343)
1 parent a936884 commit eda7e4a

File tree

4 files changed

+1
-417
lines changed

4 files changed

+1
-417
lines changed

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

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2568,14 +2568,7 @@ internal void Run(bool inputLoopIsNested)
25682568
// Evaluate any suggestions
25692569
if (previousResponseWasEmpty == false)
25702570
{
2571-
if (ExperimentalFeature.IsEnabled(ExperimentalFeature.PSFeedbackProvider))
2572-
{
2573-
EvaluateFeedbacks(ui);
2574-
}
2575-
else
2576-
{
2577-
EvaluateSuggestions(ui);
2578-
}
2571+
EvaluateFeedbacks(ui);
25792572
}
25802573

25812574
// Then output the prompt
@@ -2899,44 +2892,6 @@ private void EvaluateFeedbacks(ConsoleHostUserInterface ui)
28992892
}
29002893
}
29012894

2902-
private void EvaluateSuggestions(ConsoleHostUserInterface ui)
2903-
{
2904-
// Output any training suggestions
2905-
try
2906-
{
2907-
List<string> suggestions = HostUtilities.GetSuggestion(_parent.Runspace);
2908-
2909-
if (suggestions.Count > 0)
2910-
{
2911-
ui.WriteLine();
2912-
}
2913-
2914-
bool first = true;
2915-
foreach (string suggestion in suggestions)
2916-
{
2917-
if (!first)
2918-
ui.WriteLine();
2919-
2920-
ui.WriteLine(suggestion);
2921-
2922-
first = false;
2923-
}
2924-
}
2925-
catch (TerminateException)
2926-
{
2927-
// A variable breakpoint may be hit by HostUtilities.GetSuggestion. The debugger throws TerminateExceptions to stop the execution
2928-
// of the current statement; we do not want to treat these exceptions as errors.
2929-
}
2930-
catch (Exception e)
2931-
{
2932-
// Catch-all OK. This is a third-party call-out.
2933-
ui.WriteErrorLine(e.Message);
2934-
2935-
LocalRunspace localRunspace = (LocalRunspace)_parent.Runspace;
2936-
localRunspace.GetExecutionContext.AppendDollarError(e);
2937-
}
2938-
}
2939-
29402895
private string EvaluatePrompt()
29412896
{
29422897
string promptString = _promptExec.ExecuteCommandAndGetResultAsString("prompt", out _);

src/System.Management.Automation/engine/ExperimentalFeature/ExperimentalFeature.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
using System.Collections;
54
using System.Collections.Generic;
65
using System.Collections.ObjectModel;
76
using System.Linq;
@@ -21,7 +20,6 @@ public class ExperimentalFeature
2120
#region Const Members
2221

2322
internal const string EngineSource = "PSEngine";
24-
internal const string PSFeedbackProvider = "PSFeedbackProvider";
2523
internal const string PSSerializeJSONLongEnumAsNumber = nameof(PSSerializeJSONLongEnumAsNumber);
2624

2725
#endregion
@@ -108,9 +106,6 @@ static ExperimentalFeature()
108106
new ExperimentalFeature(
109107
name: "PSLoadAssemblyFromNativeCode",
110108
description: "Expose an API to allow assembly loading from native code"),
111-
new ExperimentalFeature(
112-
name: PSFeedbackProvider,
113-
description: "Replace the hard-coded suggestion framework with the extensible feedback provider"),
114109
new ExperimentalFeature(
115110
name: PSSerializeJSONLongEnumAsNumber,
116111
description: "Serialize enums based on long or ulong as an numeric value rather than the string representation when using ConvertTo-Json."

0 commit comments

Comments
 (0)