Predictor: Predictor

class PoshPredictiveText.Init : IModuleAssemblyInitializer, IModuleAssemblyCleanup

Register the predictor on module loading and unregister it on module un-loading.

Public Functions

void OnImport ()

Gets called when assembly is loaded.

void OnRemove (PSModuleInfo psModuleInfo)

Gets called when the binary module is unloaded.

class PoshPredictiveText.Predictor : ICommandPredictor

PSReadLine plugin providing predictive text capabilities.

Public Functions

SuggestionPackage GetSuggestion (PredictionClient client, PredictionContext context, CancellationToken cancellationToken)

Get the predictive suggestions. It indicates the start of a suggestion rendering session.

Param client:

Represents the client that initiates the call.

Param context:

The PredictionContext object to be used for prediction.

Param cancellationToken:

The cancellation token to cancel the prediction.

Return:

An instance of SuggestionPackage.

bool CanAcceptFeedback (PredictionClient client, PredictorFeedbackKind feedback)

Gets a value indicating whether the predictor accepts a specific kind of feedback.

Param client:

Represents the client that initiates the call.

Param feedback:

A specific type of feedback.

Return:

True or false, to indicate whether the specific feedback is accepted.

void OnSuggestionDisplayed (PredictionClient client, uint session, int countOrIndex)

One or more suggestions provided by the predictor were displayed to the user.

Param client:

Represents the client that initiates the call.

Param session:

The mini-session where the displayed suggestions came from.

Param countOrIndex:

When the value is greater than 0, it’s the number of displayed suggestions from the list returned in session , starting from the index 0. When the value is less than or equal to 0, it means a single suggestion from the list got displayed, and the index is the absolute value.

void OnSuggestionAccepted (PredictionClient client, uint session, string acceptedSuggestion)

The suggestion provided by the predictor was accepted.

Param client:

Represents the client that initiates the call.

Param session:

Represents the mini-session where the accepted suggestion came from.

Param acceptedSuggestion:

The accepted suggestion text.

void OnCommandLineAccepted (PredictionClient client, IReadOnlyList<string> history)

A command line was accepted to execute. The predictor can start processing early as needed with the latest history.

Param client:

Represents the client that initiates the call.

Param history:

History command lines provided as references for prediction.

void OnCommandLineExecuted (PredictionClient client, string commandLine, bool success)

A command line was done execution.

Param client:

Represents the client that initiates the call.

Param commandLine:

The last accepted command line.

Param success:

Shows whether the execution was successful.

Properties

Guid Id { get; set; }

Gets the unique identifier for a subsystem implementation.

string? Name { get; set; }

Gets the name of a command for which suggestion are being made.

string Description { get; set; }

Gets the description of a subsystem implementation.