Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/shell/elvish/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type complexCandidate struct {
Description string
CodeSuffix string
Style string
Tag string
}

// ActionRawValues formats values for elvish.
Expand All @@ -60,7 +61,7 @@ func ActionRawValues(currentWord string, meta common.Meta, values common.RawValu
if val.Style == "" || ui.ParseStyling(val.Style) == nil {
val.Style = valueStyle
}
vals[index] = complexCandidate{Value: val.Value, Display: val.Display, Description: val.Description, CodeSuffix: suffix, Style: val.Style}
vals[index] = complexCandidate{Value: val.Value, Display: val.Display, Description: val.Description, CodeSuffix: suffix, Style: val.Style, Tag: val.Tag}
}

if len(values) > 0 {
Expand Down
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]
} 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]
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