mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Remove the comment trigger from feedback provider (#20136)
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
+4
-9
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user