Add option to change timeout of 20ms of ICommandPredictor ("ICommandPredictor interface has a 20ms time out for responses from the Predictors") #4029
Labels
Issue-Enhancement
It's a feature request.
Needs-Triage 🔍
It's a new issue that core contributor team needs to triage.
Prerequisites
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.
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/
The text was updated successfully, but these errors were encountered: