Open rsteube opened 9 months ago
Some way to control if a space suffix shall be added.
A longstanding issue is that serialized completions don't carry metadata.
I agree we should try to add them and propagate flags like NO_SPACE
.
Either a separate value or support ansi esscape codes for display.
Once we have flags we can add one to allow to disable coloring for individual completions.
Fish currently truncates the value without knowing where to cut.
I'd rather see a generalized improvement here (also we want to be somewhat honest about what will be inserted). I tried changing this to only show what's not on the command line but it didn't look great in some cases. The current behavior is a nice compromise but maybe we can improve it.
Errors are currently embedded into the values as workaround. Additional identifier for the values like subcommand group, files, branches to filter or group them.
Hmm, we could add a text field (separate from the completion pager), that should work for both?
I'd rather see a generalized improvement here (also we want to be somewhat honest about what will be inserted). I tried changing this to only show what's not on the command line but it didn't look great in some cases. The current behavior is a nice compromise but maybe we can improve it.
True, but I don't think there is much room for improvement here without having additional context from the completion scripts. To be clear: In my case I do have the data for this as there is a separation between displayed and inserted value (see Prefix / Suffix).
Hmm, we could add a text field (separate from the completion pager), that should work for both?
Yes, that is how it is done it zsh: one multiline string with different coloring.
Note that displaying errors is possible (with color or what have you) but not "natively" via the completions machinery. See for example the npm
completions:
function __npm_helper_installed
# This function takes the command to globally install a package as $argv[1]
if not type -q all-the-package-names
if not set -qg __fish_npm_pkg_info_shown
set -l old (commandline)
commandline -r ""
echo \nfish: Run `$argv[1] all-the-package-names` to gain intelligent \
package completion >&2
commandline -f repaint
commandline -r $old
set -g __fish_npm_pkg_info_shown 1
end
return 1
end
end
So in carapace I've got data like this. Would be nice if fish would provide a bit more control over the completion values.
What might work is accepting
json
additionally to thevalue\tdescription
format. Meaning: check if response starts with{
and try to parse the result asjson
otherwise fallback to the default.Display
What to show during completion. Fish currently truncates the value without knowing where to cut.
Style
How to highlight the displayed value (color, bold, underlined...). Either a separate value or support ansi esscape codes for display.
Space Suffix
Some way to control if a space suffix shall be added. E.g. when completing a command that is passed as string.
Error / Usage
Some way to show error and usage messages separate from the completion values. Errors are currently embedded into the values as workaround.
Tags
Additional identifier for the values like
subcommand group
,files
,branches
to filter or group them.related #7832