Skip to content

Commit

Permalink
[release/v7.4.0-preview.6] Remove the comment trigger from feedback p…
Browse files Browse the repository at this point in the history
…rovider (#20136) (#20346)
  • Loading branch information
daxian-dbw committed Sep 25, 2023
1 parent 90f64aa commit f57878b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
Expand Up @@ -183,12 +183,10 @@ public static class FeedbackHub

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;
Expand Down Expand Up @@ -249,7 +247,8 @@ private static bool CanSkip(IEnumerable<IFeedbackProvider> providers)

if (IsPureComment(tokens))
{
trigger = FeedbackTrigger.Comment;
// Don't trigger anything in this case.
return false;
}
else if (questionMarkValue)
{
Expand Down
Expand Up @@ -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>
Expand Down

0 comments on commit f57878b

Please sign in to comment.