Skip to content
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

How to browse arguments / parameters while typing automatically based on --help ? #3848

Closed
1 task done
oxysoft opened this issue Oct 24, 2023 · 3 comments
Closed
1 task done
Labels
Issue-Enhancement It's a feature request.

Comments

@oxysoft
Copy link

oxysoft commented Oct 24, 2023

Prerequisites

  • Write a descriptive title.

Description of the new feature/enhancement

Hi, I'm not sure if I'm missing something, this seems like the most basic use-case. The --help pages are all written already in a standard format for each command, so I'm not sure why it's not fetching the information and displaying it as soon as I type two dashes. Is there a way to achieve this behavior with PSReadLine? I'm hoping there's a list somewhere with all such cool plugins that people have made for PSReadLine?

Thanks

Proposed technical implementation details (optional)

No response

@oxysoft oxysoft added the Issue-Enhancement It's a feature request. label Oct 24, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Oct 24, 2023
@daxian-dbw
Copy link
Member

@oxysoft Please take a look at https://github.com/PowerShell/completionPredictor, which may offer what you want. That module is available on PowerShell Gallery.

For more information about the predictive intellisense, see https://learn.microsoft.com/powershell/scripting/learn/shell/using-predictors?view=powershell-7.3

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Oct 24, 2023
@oxysoft
Copy link
Author

oxysoft commented Oct 24, 2023

Hi, I see now that it was working all along, the problem is that it doesn't work with RipGrep. Is it because the argument format is different than typical PowerShell? (unix style with -L or --long-name) To be clear I am using the Windows binary for ripgrep, however the usage is not adapted to PowerShell's philosophy.

@daxian-dbw
Copy link
Member

The CompletionPredictor depends on tab completion in PowerShell as the source for prediction. It requires the completion to be enabled for a command (RipGrep in this case) and the completion needs to be fast enough (timeout is 20ms as of today).

In theory, you can create the tab completion for RipGrep (see Register-ArgumentCompleter), but you will need to do completion based on the help docs for that tool instead of depending on spinning up RipGrep, because the overhead of starting a process is too much for the timeout we have for prediction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement It's a feature request.
Projects
None yet
Development

No branches or pull requests

2 participants