Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

complete: support json for complex arguments #10197

Open
rsteube opened this issue Jan 7, 2024 · 2 comments
Open

complete: support json for complex arguments #10197

rsteube opened this issue Jan 7, 2024 · 2 comments

Comments

@rsteube
Copy link

rsteube commented Jan 7, 2024

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 the value\tdescription format.
Meaning: check if response starts with { and try to parse the result as json otherwise fallback to the default.

Display

What to show during completion.
Fish currently truncates the value without knowing where to cut.

image

image

Style

How to highlight the displayed value (color, bold, underlined...).
Either a separate value or support ansi esscape codes for display.

image

image

Space Suffix

Some way to control if a space suffix shall be added.
E.g. when completing a command that is passed as string.

image

image

Error / Usage

Some way to show error and usage messages separate from the completion values.
Errors are currently embedded into the values as workaround.

image

image

Tags

Additional identifier for the values like subcommand group, files, branches to filter or group them.

image

image

related #7832

@krobelus
Copy link
Member

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?

@rsteube
Copy link
Author

rsteube commented Jan 16, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants