clap icon indicating copy to clipboard operation
clap copied to clipboard

Style completion options with rust-native completions

Open epage opened this issue 1 year ago • 3 comments

Two halves to this

Some completion options have a "pretty" mode, a display-only completion result

Next step is coloring of that, see

  • https://carapace.sh/
  • https://carapace-sh.github.io/carapace/carapace/action/style.html

epage avatar Aug 10 '24 00:08 epage

This could likely be a pretty: Option<StyledStr> and wouldn't require a breaking change.

epage avatar Aug 10 '24 20:08 epage

It looks like powershell has native support for a "pretty" or "display" value called listItemText

https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.completionresult.-ctor?view=powershellsdk-7.4.0#system-management-automation-completionresult-ctor(system-string-system-string-system-management-automation-completionresulttype-system-string)

epage avatar Sep 04 '24 19:09 epage

Carapace

For bash, it includes the display item in the description https://github.com/carapace-sh/carapace/blob/68d3237f5321f743ec0428e450957b797f3889b3/internal/shell/bash/action.go#L100-L106

For zsh, it does display:description. Unsure if that is special zsh syntax https://github.com/carapace-sh/carapace/blob/68d3237f5321f743ec0428e450957b797f3889b3/internal/shell/zsh/action.go#L70-L74

For elvish, its communicating via json

epage avatar Sep 04 '24 19:09 epage