May 10th, 2023

Completion Predictor v0.1.1 Release

Steven Bucher
Product Manager

We’ve recently released a new version of the Completion Predictor! We’ve been highlighting this predictor when showing off some of the new improvements in the PSReadLine 2.3.x betas and wanted to share some of the awesome things you can do with this predictor.

Completion Predictor v0.1.1

If you are unfamiliar with the Completion Predictor, this is a plugin in predictor that we released last year that provides tab completion to help give prediction results. This means it can work for helping fill out parameters of cmdlets and properties and methods of objects. The Version 0.1.1 release contains some experience improvements and some new completion capabilities.

Installing Completion Predictor v0.1.1

First and foremost, how can you get this predictor? The release is available from the PowerShell Gallery.

Use the following command to install CompletionPredictor using PowerShellGet v2.x:

Install-Module -Name CompletionPredictor

If you are using PowerShellGet v3, you can use the following command:

Install-PSResource -Name CompletionPredictor

Argument Completion Improvements

cd and dir

Using tab completion we’re able to give predictions on the next folders you may want to navigate to with cd or view the contents of with dir.

Screenshot showing cd and dir argument completion.

git

Another argument completion improvement was with git. These are improvements that we’ve found works best for our workflow but may help with your git workflow as well!

Merging branches

Completion Predictor is able to look at remote and local branches available to accelerate your flow when using git merge. Here is an example of it working.

Screenshot showing git merge prediction completion.

 

Checking out and deleting branches

Similarly, to the merge behavior, the completion predictor is now able to give predictions on what branch you may want to use when checking out or deleting branches. This only works with the subcommands git checkout and git branch -D. The predictor intentionally doesn’t include the current branch you are in when giving results.

Screenshot showing git branch -D prediction completion.

As I mentioned, we added these improvements to help with our specific git workflows. Typically, the rough flow we’ve is the following:

  • git fetch --all -p -> to get the latest changes in that repo
  • git merge -> sync the default branch
  • git branch -D -> delete the old working branches that were already removed from the remote side
  • git checkout -> checkout a new branch to work in
  • git push -> push the new branch to remote to then create a PR

This isn’t a blog post about how to best use git, so please refer to other online resources to learn git. This is just the workflow we like to use that helped us create the git improvements to the Completion Predictor.

Feedback

You can find the rest of the changes in this release in the changelog on the release page. We love getting feedback on these predictors we make! The entire source code for this predictor is available on GitHub and can be a great starting point for making your own predictor! Please feel free to open issues or PRs on the GitHub page for improvements that may work for you and others! Enjoy!

Steven Bucher and Dongbo Wang

Completion Predictor and PSReadLine Maintainers

Author

Steven Bucher
Product Manager

0 comments

Discussion are closed.