Skip to content

Commit bdefe3d

Browse files
committed
support both for now
1 parent 78225f0 commit bdefe3d

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

internal/shell/elvish/snippet.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,18 @@ func Snippet(cmd *cobra.Command) string {
1919
edit:notify (styled "usage: " $completion[DescriptionStyle])$completion[Usage]
2020
}
2121
put $completion[Candidates] | all (one) | peach {|c|
22-
if (eq $c[Description] "") {
23-
edit:complex-candidate $c[Value] &display=(styled $c[Display] $c[Style]) &code-suffix=$c[CodeSuffix] &tag=$c[Tag]
24-
} else {
25-
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]
22+
try {
23+
if (eq $c[Description] "") {
24+
edit:complex-candidate $c[Value] &display=(styled $c[Display] $c[Style]) &code-suffix=$c[CodeSuffix] &tag=$c[Tag]
25+
} else {
26+
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]
27+
}
28+
} catch {
29+
if (eq $c[Description] "") {
30+
edit:complex-candidate $c[Value] &display=(styled $c[Display] $c[Style]) &code-suffix=$c[CodeSuffix]
31+
} else {
32+
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]
33+
}
2634
}
2735
}
2836
}

0 commit comments

Comments
 (0)