Remove the comment trigger from feedback provider (#20136)

This commit is contained in:
Dongbo Wang
2023-08-21 11:48:48 -07:00
committed by GitHub
parent 050873fc28
commit 7f44006a1b
2 changed files with 7 additions and 13 deletions
@@ -183,12 +183,10 @@ namespace System.Management.Automation.Subsystem.Feedback
private static bool CanSkip(IEnumerable<IFeedbackProvider> providers)
{
const FeedbackTrigger possibleTriggerOnSuccess = FeedbackTrigger.Success | FeedbackTrigger.Comment;
bool canSkip = true;
foreach (IFeedbackProvider provider in providers)
{
if ((provider.Trigger & possibleTriggerOnSuccess) != 0)
if (provider.Trigger.HasFlag(FeedbackTrigger.Success))
{
canSkip = false;
break;
@@ -249,7 +247,8 @@ namespace System.Management.Automation.Subsystem.Feedback
if (IsPureComment(tokens))
{
trigger = FeedbackTrigger.Comment;
// Don't trigger anything in this case.
return false;
}
else if (questionMarkValue)
{
@@ -18,32 +18,27 @@ namespace System.Management.Automation.Subsystem.Feedback
[Flags]
public enum FeedbackTrigger
{
/// <summary>
/// The last command line is comment only.
/// </summary>
Comment = 0x0001,
/// <summary>
/// The last command line executed successfully.
/// </summary>
Success = 0x0002,
Success = 0x0001,
/// <summary>
/// The last command line failed due to a command-not-found error.
/// This is a special case of <see cref="Error"/>.
/// </summary>
CommandNotFound = 0x0004,
CommandNotFound = 0x0002,
/// <summary>
/// The last command line failed with an error record.
/// This includes the case of command-not-found error.
/// </summary>
Error = CommandNotFound | 0x0008,
Error = CommandNotFound | 0x0004,
/// <summary>
/// All possible triggers.
/// </summary>
All = Comment | Success | Error
All = Success | Error
}
/// <summary>