PowerShell / PowerShell

PowerShell for every system!
https://microsoft.com/PowerShell
MIT License
43.66k stars 7.08k forks source link

Discussion issue for IFeedbackProvider on Success Noisy Scenarios #19452

Closed StevenBucher98 closed 1 week ago

StevenBucher98 commented 1 year ago

Summary of the new feature / enhancement

Description

When thinking about having the Feedback Provider of PowerShell be able to trigger on success, per #19372, there is a concern around if this will be very noisy and annoying to users. The basic scenario being that a user runs a command successfully but there is potentially a better way or suggested way to enhance their experience, like the JSON adapter proposition in #19372. This could also be a good way to expose capabilities of PowerShell and nuances to help inform the user about potential ramifications.

Example

Reallocation of array each time for addition:

>$a = @()
>$a += 1
>$a += 2

This works and is successful but a more memory conscious approach would be:

>$a = [System.Collections.ArrayList]::new() 
or
>$a = [System.Collections.Generic.List[object]]::new()

The feedback provider could suggestion something like

>$a = @()
>$a += 1
[suggestion]
  $a is being reallocated each time you append to it, consider defining it as a list:
    -> $a = [System.Collections.ArrayList]::new() 

Proposed technical implementation details (optional)

Questions

The scenarios outlined above begs a lot of questions about the experience of Feedback Providers and if its something the PowerShell engine should step in to ensure "non noisy" behavior or let the feedback providers themselves be responsible for. For contexts feedback providers are developed as extensible PowerShell modules that can be imported.

If left up to the engine:

I am sure I am missing some questions or scenarios but want to open an issue to track these and have a discussion around this concept, any and all feedback is appreciated!

Other related PRs/issues with Feedback Providers

cc @daxian-dbw @SteveL-MSFT @JamesWTruher

StevenBucher98 commented 1 year ago

Additional improvements to think about:

StevenBucher98 commented 1 year ago

We potentially we should provide some built in options for reducing the noise but also have a way for feedback providers to overwrite it.

microsoft-github-policy-service[bot] commented 6 months ago

This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

microsoft-github-policy-service[bot] commented 2 weeks ago

This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically.

Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original.