-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Currently, the powershell script that gets generated uses the default plain mode and therefore cannot use the description.
If the installer would default to json (see #8 ), then the existing CompletionResultItem.Description could be taken into account.
This is what I suggest:
- Enable json also on .NET Framework ([Feature] Support Json format also on .NET Framework #8)
- Default to json format when calling
completion powershell --install- (optional) Add an additional parameter for installer
- Update script to use json (see below)
Completer Snippet
...
# TODO: get from settings
$format = "json"
$completions = @()
if (Test-Path -PathType Leaf -Path ".\App.exe"){
$completions = & ".\App.exe" completion complete --position $cursorPosition "$wordToComplete" --format $format
}
else{
$completions = & "C:\<path>\App.exe" completion complete --position $cursorPosition "$wordToComplete" --format $format
}
$format -eq "json") {
# parse json format
$completions = $completions | ConvertFrom-Json
}
if ($completions) {
if ($format -eq "json") {
foreach ($completion in $completions) {
[System.Management.Automation.CompletionResult]::new($completion.Value , $completion.Description, 'ParameterValue', $completion.Value)
}
} else {
foreach ($completion in $completions) {
[System.Management.Automation.CompletionResult]::new($completion , $completion, 'ParameterValue', $completion)
}
}
}
else {
$null
}
....Metadata
Metadata
Assignees
Labels
No labels