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
Provide a base class, ArgumentCompleter, to simplify writing custom argument completers
Some common tasks need to be done almost every time a completer is written.
Things like quoting arguments if they contain spaces, matching against WordToComplete, and ensuring that the results are sorted is another such task.
Motivation
As a Developer,
I can use the base class when writing custom argument completers,
so that results are achieved faster, with high quality, and
so that users get a consistent completion experience.
User Experience
usingnamespaceSystem.Management.Automation;publicclassGetCommitCompleter:ArgumentCompleter{// override simplified completerprotectedoverrideCompletionResultSortKindAddCompletionsFor(stringcommandName,stringparameterName,IDictionaryfakeBoundParameters){switch(parameterName){casenameof(GitRebaseCommand.CommitHash):CompleteGitCommitHash();break;}returnCompletionResultSortKind.Sorted;}privatevoidCompleteGitCommitHash(){varuser=GetFakeBoundParameter<string>("User");foreach(varcommitinGitExe.Log()){if(useris{}u&&commit.User!=u){continue;}// use a function to complete if the text or tooltip matches WordToCompleteCompleteMatching(text:commit.Hash,tooltip:$"{commit.User}\r\n{commit.Description}}": CompletionMatch.AnyContainsWithWordToComplete);}}}
The text was updated successfully, but these errors were encountered:
#269
Provide a base class, ArgumentCompleter, to simplify writing custom argument completers
Some common tasks need to be done almost every time a completer is written.
Things like quoting arguments if they contain spaces, matching against WordToComplete, and ensuring that the results are sorted is another such task.
Motivation
As a Developer,
I can use the base class when writing custom argument completers,
so that results are achieved faster, with high quality, and
so that users get a consistent completion experience.
User Experience
The text was updated successfully, but these errors were encountered: