daxian-dbw / CompletionPredictor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CompletionPredictor

The CompletionPredictor is a PowerShell command line auto-completion plugin for the PSReadLine Predictive Intellisense feature:

CompletionPredictor

This predictor is relatively simple and also serves as an example for you to build your own predictor.

We welcome your feedback and suggestions. Please file issues and submit pull requests in this repository.

Requirements

The CompletionPredictor plugin is built on the Subsystem Plugin Model, which is available with PowerShell 7.2 or above. To display prediction suggestions from the CompletionPredictor, you need PSReadLine 2.2.2 or above.

  • PowerShell 7.2 or above
  • PSReadLine 2.2.2 or above

Predictor documentation

PowerShell predictors are written in C# and registered with the PowerShell Subsystem Plugin Model. To learn more, see "How to create a command-line predictor".

Build

Make sure the latest .NET 6 SDK is installed and available in your PATH environment variable. Run .\build.ps1 from PowerShell to build the project. The module will be published to .\bin\CompletionPredictor by a successful build.

Use the predictor

NOTE: Make sure you use PowerShell 7.2 with PSReadLine 2.2.2.

  1. Install the module by Install-Module -Name CompletionPredictor -Repository PSGallery
  2. Import the module to register the plugin with the PSSubsystem: Import-Module -Name CompletionPredictor
  3. Enable prediction from the plugin source for PSReadLine: Set-PSReadLineOption -PredictionSource HistoryAndPlugin
  4. Switch between the Inline and List prediction views, by pressing F2

About

License:MIT License


Languages

Language:C# 77.8%Language:PowerShell 22.2%