Open epage opened 2 years ago
Hello
For Powershell
Register-ArgumentCompleter
-CommandName <String[]>
-ScriptBlock <ScriptBlock>
[-Native]
[<CommonParameters>]
The block receives
When you specify the Native parameter, the script block must take the following parameters in the specified order. The names of the parameters aren't important because PowerShell passes in the values by position.
- $wordToComplete (Position 0) - This parameter is set to value the user has provided before they pressed Tab. Your script block should use this value to determine tab completion values.
- $commandAst (Position 1) - This parameter is set to the Abstract Syntax Tree (AST) for the current input line. For more information, see Ast Class.
- $cursorPosition (Position 2) - This parameter is set to the position of the cursor when the user pressed Tab.
The block provides CompletionResult
The CompletionResult object allows you to provide additional details to each returned value:
- completionText (String) - The text to be used as the auto completion result. This is the value sent to the command.
- listItemText (String) - The text to be displayed in a list, such as when the user presses Ctrl+Space. This is used for display only and is not passed to the command when selected.
- resultType (CompletionResultType) - The type of completion result.
- toolTip (String) - The text for the tooltip with details to be displayed about the object. This is visible when the user selects an item after pressing Ctrl+Space.
So it seems like Powershell can fit within rust-driven completions and provide the full feature set.
See #3166 for more context
Tasks