Skip to content

De-duplicate prediction results with the history results #3543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2023

Conversation

daxian-dbw
Copy link
Member

@daxian-dbw daxian-dbw commented Jan 19, 2023

PR Summary

De-duplicate prediction results with the history results.
A prediction result could be the same as the one found in history. This happens sometimes to the Az predictor.
When used in list view, it's confusing for the user to see 2 same results in the list, both from history and a predictor. So, we de-duplicate the prediction results against the history results.

For now, we only remove the prediction results that are exactly the same (case-sensitive or case-insensitive decided by the user with the 'HistorySearchCaseSensitive' setting, which is false by default) as one of the history results.

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Make sure you've added one or more new tests
  • Make sure you've tested these changes in terminals that PowerShell is commonly used in (i.e. conhost.exe, Windows Terminal, Visual Studio Code Integrated Terminal, etc.)
  • User-facing changes
    • Not Applicable
    • OR
    • Documentation needed at PowerShell-Docs
      • Doc Issue filed:
Microsoft Reviewers: Open in CodeFlow

@daxian-dbw
Copy link
Member Author

/cc @StevenBucher98: this is for the de-duplication work item. It could be great if we can verify the new user experience with Az predictor (if we can reproduce the issue in Az predictor).

Copy link
Collaborator

@StevenBucher98 StevenBucher98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, awesome work Dongbo!

Verified previous duplications with Az Predictor are no longer there on this branch

Copy link
Member

@andyleejordan andyleejordan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks Dongbo!

Comment on lines +479 to +488
// NOTE: when any duplicate results were skipped, the 'count' passed in here won't be accurate as it still includes
// those skipped ones. This is due to the limitation of the 'OnSuggestionDisplayed' interface method, which didn't
// assume any prediction results from a predictor could be filtered out at the initial design time. We will have to
// change the predictor interface to pass in accurate information, such as:
// void OnSuggestionDisplayed(Guid predictorId, uint session, int countOrIndex, int[] skippedIndices)
//
// However, an interface change has huge impacts. At least, a newer version of PSReadLine will stop working on the
// existing PowerShell 7+ versions. For this particular issue, the chance that it could happen is low and the impact
// of the inaccurate feedback is also low, so we should delay this interface change until another highly-demanded
// change to the interface is required in future (e.g. changes related to supporting OpenAI models).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the detailed note 👍

@daxian-dbw
Copy link
Member Author

Thank you both for the reivew!

@daxian-dbw daxian-dbw merged commit 659c828 into PowerShell:master Jan 23, 2023
@daxian-dbw daxian-dbw deleted the de-dup branch January 23, 2023 19:04
@ghost
Copy link

ghost commented Mar 8, 2023

🎉 v2.3.0-beta0 has been released which incorporates this pull request. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants