Support trigger registration in Feedback Provider
PR Summary
PR Context
Address #19372 and address #19364
- Allow a feedback provider to register the trigger for it to be called. The triggers are:
Comment,Success,CommandNotFound,Error, andAll. By default, a feedback provider will be triggered byCommandNotFoundonly. - Some refactoring:
- update the interface method to pass in more context information.
- split the
FeedbackHub.GetFeedbackmethods into multiple helper methods to reduce its complexity.
PR Checklist
- [x] PR has a meaningful title
- Use the present tense and imperative mood when describing your changes
- [x] Summarized changes
- [x] Make sure all
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header - [ ] This PR is ready to merge and is not Work in Progress.
- If the PR is work in progress, please add the prefix
WIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.
- If the PR is work in progress, please add the prefix
- Breaking changes
- [ ] None
- OR
- [x] Experimental feature(s) needed
- [x] Experimental feature name(s): PSFeedbackProvider
- User-facing changes
- [x] Not Applicable
- OR
- [ ] Documentation needed
- [ ] Issue filed:
- Testing - New and feature
- [ ] N/A or can only be tested interactively
- OR
- [x] Make sure you've added a new test if existing tests do not effectively test the code changed
- Tooling
- [x] I have considered the user experience from a tooling perspective and don't believe tooling will be impacted.
It's helpful to ignore the whitespace changes during the review: https://github.com/PowerShell/PowerShell/pull/19525/files?w=1
:tada:v7.4.0-preview.3 has been released which incorporates this pull request.:tada:
Handy links:
@daxian-dbw sorry to be late to the party on this, but I don't think the feedback trigger should have a default, it should be explicitly implemented. This bit me when writing a provider because when I used my IDE to implement the interface, it didn't pull this in and I couldn't figure out why it wasn't working. Since it is RC it may be too late since this would be breaking for existing feedback providers that haven't explicitly stated it, but just a thought.