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
When I use the Powershell completion, then it fails to complete, when I want to complete the first word, e.g. con<tab> or com<tab> - should result in config or completion respectively. Instead neither happens.
I also found the issue in the completion code while writing this issue:
$Values=$Out|ForEach-Object {
#Split the output in name and description$Name,$Description=$_.Split("`t",2)
__oh-my-posh_debug "Name: $Name Description: $Description"# Look for the longest completion so that we can format things nicelyif ($Longest-lt$Name.Length) {
$Longest=$Name.Length
}
# Set the description to a one space string if there is none set.# This is needed because the CompletionResult does not accept an empty string as argumentif (-Not$Description) {
$Description=""
}
@{Name="$Name"; Description="$Description" }
}
When there is only one completion result, which is oddly the case for oh-my-posh __complete con but not for oh-my-posh __complete config ex, then the above code makes $Values a hashtable and not an array, which results in a hidden error down the line, because a hashtable has no Length property.
if (($Directive-band$ShellCompDirectiveNoFileComp) -ne0 ) {
__oh-my-posh_debug "ShellCompDirectiveNoFileComp is called";
if ($Values.Length-eq0) {
# Just print an empty string here so the# shell does not start to complete paths.# We cannot use CompletionResult here because# it does not accept an empty string as argument.""return
}
}
My simple workaround has been forcing $Values to become an array by doing this [Array]$Values in the first code fragment.
Theme
Not relevant
What OS are you seeing the problem on?
Windows
Which shell are you using?
powershell
Log output
Not relevant
The text was updated successfully, but these errors were encountered:
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues.
If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.
Code of Conduct
What happened?
When I use the Powershell completion, then it fails to complete, when I want to complete the first word, e.g.
con<tab>
orcom<tab>
- should result in config or completion respectively. Instead neither happens.I also found the issue in the completion code while writing this issue:
When there is only one completion result, which is oddly the case for
oh-my-posh __complete con
but not foroh-my-posh __complete config ex
, then the above code makes$Values
a hashtable and not an array, which results in a hidden error down the line, because a hashtable has noLength
property.My simple workaround has been forcing
$Values
to become an array by doing this[Array]$Values
in the first code fragment.Theme
Not relevant
What OS are you seeing the problem on?
Windows
Which shell are you using?
powershell
Log output
The text was updated successfully, but these errors were encountered: