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
Original file line number Diff line number Diff line change
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 TryGetFeedbackContext(

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