Skip to content

Commit

Permalink
support both for now
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Jan 12, 2024
1 parent faf7259 commit fb4f802
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions internal/shell/elvish/snippet.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,18 @@ func Snippet(cmd *cobra.Command) string {
edit:notify (styled "usage: " $completion[DescriptionStyle])$completion[Usage]
}
put $completion[Candidates] | all (one) | peach {|c|
if (eq $c[Description] "") {
edit:complex-candidate $c[Value] &display=(styled $c[Display] $c[Style]) &code-suffix=$c[CodeSuffix] &tag=$c[Tag]
} else {
edit:complex-candidate $c[Value] &display=(styled $c[Display] $c[Style])(styled " " $completion[DescriptionStyle]" bg-default")(styled "("$c[Description]")" $completion[DescriptionStyle]) &code-suffix=$c[CodeSuffix] &tag=$c[Tag]
try {
if (eq $c[Description] "") {
edit:complex-candidate $c[Value] &display=(styled $c[Display] $c[Style]) &code-suffix=$c[CodeSuffix] &tag=$c[Tag]
} else {
edit:complex-candidate $c[Value] &display=(styled $c[Display] $c[Style])(styled " " $completion[DescriptionStyle]" bg-default")(styled "("$c[Description]")" $completion[DescriptionStyle]) &code-suffix=$c[CodeSuffix] &tag=$c[Tag]
}
} catch {
if (eq $c[Description] "") {
edit:complex-candidate $c[Value] &display=(styled $c[Display] $c[Style]) &code-suffix=$c[CodeSuffix]
} else {
edit:complex-candidate $c[Value] &display=(styled $c[Display] $c[Style])(styled " " $completion[DescriptionStyle]" bg-default")(styled "("$c[Description]")" $completion[DescriptionStyle]) &code-suffix=$c[CodeSuffix]
}
}
}
}
Expand Down

0 comments on commit fb4f802

Please sign in to comment.