You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Predictive completion not working with completion scripts generated by the cobra library #24
Make sure you are able to repro it on the latest version
Search the existing issues.
Steps to reproduce
Import the CompletionPredictor module with Import-Module -Name CompletionPredictor
Set the PredictionSource option to HistoryAndPlugin with Set-PSReadLineOption -PredictionSource HistoryAndPlugin
Generate and execute a cobra-generated completion script (e.g., kubectl completion powershell | Out-String | Invoke-Expression)
Type a command that uses the completion script (e.g., kubectl get pods) and try to use predictive completion.
Expected behavior
~ ❯ kubectl get
> kubectl get pods [Completion]
> kubectl get csr [Completion]
> kubectl get nodes [Completion]
> ...
Actual behavior
~ ❯ kubectl get
> kubectl get pods [History]
Error details
No response
Environment data
Name Value
---------
PSVersion 7.3.4
PSEdition Core
GitCommitId 7.3.4
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0,2.0,3.0,4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Hi Dongbo Wang (@daxian-dbw), currently, all custom completions and executable files do not prompt. Is there a way to achieve this functionality?
Unfortunately, the completion for native commands doesn't work with completion predictor today because they are too slow.
For a predictor to work with PSReadLine today, it needs to return results within 20ms, which is impossibly for most of native command completers. We have a work item in PSReadLine to allow longer timeout by separating the prediction rendering from the user typing rendering, but we haven't got to it yet.
Activity
Daydreamer-riri commentedon Aug 5, 2024
Hi Dongbo Wang (@daxian-dbw), currently, all custom completions and executable files do not prompt. Is there a way to achieve this functionality?
daxian-dbw commentedon Aug 5, 2024
Unfortunately, the completion for native commands doesn't work with completion predictor today because they are too slow.
For a predictor to work with PSReadLine today, it needs to return results within 20ms, which is impossibly for most of native command completers. We have a work item in PSReadLine to allow longer timeout by separating the prediction rendering from the user typing rendering, but we haven't got to it yet.
Daydreamer-riri commentedon Aug 15, 2024
Thanks for your reply! I've just seen the latest vscode terminal integration do something similar, but I'm using Windows Terminal more often than not.
nebula-it commentedon Jan 27, 2026
Any update on that work? For now is it possible to just extend the 20ms time window (or make it customizable)