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

Add option to change timeout of 20ms of ICommandPredictor ("ICommandPredictor interface has a 20ms time out for responses from the Predictors") #4029

Open
1 task done
iksi4prs opened this issue Jun 2, 2024 · 0 comments
Labels
Issue-Enhancement It's a feature request. Needs-Triage 🔍 It's a new issue that core contributor team needs to triage.

Comments

@iksi4prs
Copy link

iksi4prs commented Jun 2, 2024

Prerequisites

  • Write a descriptive title.

Description of the new feature/enhancement

Currently:
"To ensure a responsive user experience, the ICommandPredictor interface has a 20ms time out for responses from the Predictors. Your predictor code must return results in less than 20ms to be displayed."
see
https://learn.microsoft.com/en-us/powershell/scripting/dev-cross-plat/create-cmdline-predictor?view=powershell-7.4

This seem to be source code, with hard coded timeout of 20ms, see "millisecondsTimeout: 20"

src/System.Management.Automation/engine/Subsystem/PredictionSubsystem/CommandPrediction.cs

The "problem"
I find this value too low, as some of the predictors are use take more time to calculate suggestions.
I wish this value could be configured by user (me), without need to compile PowerShell.

Proposed technical implementation details (optional)

Add option to change this value, eg by using some additional call for Set-PSReadLineOption or other.
Eg, currently the next lines are used to install a predictor.

Set-PSReadLineOption -PredictionSource HistoryAndPlugin
Import-Module .\bin\Debug\net6.0\SamplePredictor.dll

The following command can be added:
Set-PSReadLineOption -PredictionTimeout 30

Technically I'm not sure if this should be Set-PSReadLineOption, or in this repo at all,
because to install the predictor, "Set-PSReadLineOption" is used,
while the timeout code is in https://github.com/PowerShell/PowerShell/

@iksi4prs iksi4prs added the Issue-Enhancement It's a feature request. label Jun 2, 2024
@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 Jun 2, 2024
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. Needs-Triage 🔍 It's a new issue that core contributor team needs to triage.
Projects
None yet
Development

No branches or pull requests

1 participant