-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Support for not inserting spaces after periods and such #7832
Comments
Not at this stage. You will be pleased to know that this was changed somewhat in #6928 (included in 3.2.0 and above) to not insert a space straight after periods. There is further discussion of customisability in that issue. |
OK, thank you for the reply. It is good to hear, that there is some awareness about the problem. Not adding a space after period will help in this special case only, but will not solve the general problem, as our dynamic grammar may branch on arbitrary characters and it is not always easy to say on which. Ideal solution would be a kind of "raw" mode for completions, disabling all fish post-processing (space adding and maybe also escaping), providing a way to exolicitly add space (if no escaping is done, this could be done just by adding a space in the suggestion 😄 ). |
One option is to not use the completion pager. The fzf integration does that; it probably uses I think there are few real-world cases where our hardcoded punctuation rules don't work, but maybe that's just a chicken-and-egg problem? If we were to implement this, there are several options for the interface:
That sounds reasonable, the "wrapper command" issue might be a concern though. |
fish, version 3.1.2 on rxvt-unicode-256color
Hi,
What we are doing:
We are developing an open-source CLI application called gWhisper, which has a dynamic and complex kind of CLI argument grammar.
To provide TAB completions we provide a way to get a list of completions, by calling the tool with the added
--complete=fish
flag.We feed this list to fish by using the command substitution feature of
complete -a
like so:What already works:
![example](https://raw.githubusercontent.com/IBM/gWhisper/master/doc/exampleHello.gif)
This works mostly fine as you can see in this recording:
Where we ran into problems:
However we noticed some strange behavior, as fish is doing heavy post processing on the given list of completions.
It boils down to two things:
.
to separate namespaces, which leads to long choice-trees until the next whitespace is reached.Example:
User wants to type:
house.bedroom.bed.pillow.operations wash temperature=60
think of user pressing
<TAB>
after typinghous
There are just too many choices to select after the
house
namespace to complete until next expected space, so our grammar look-ahead will complete until next nesting step, which is the room.The resulting list of suggestions which are passed to fish looks like this (excluding documentation):
If one of them is selected however, fish will post-process this and complete:
house.bedroom.
(with trailing space)This breaks everything, since our parser is not expecting a space here.
We noticed, that if a completion does end with some special characters like
=
or:
no space is added. This saves us some trouble, as in most cases this is by chance the point where our look-ahead algorithm stops with suggestions, but not in all cases as in the above example.What we are looking for:
We would like to have a way to disable the fish post-processing completely, allowing us to specify when a space should be completed by just adding a space into the candidate string.
NOTE: currently spaces in candidates are also post processed and are escaped, which is an other issue and should also be disabled in this "raw mode".
Alternatively it would be nice to configure the fish completion behavior in more detail (I.e. giving more control over characters after which space is added or not).
We read the
complete
manpage multiple times, but could not find a way to achieve the desired behavior 😭Is there any other API to inject more "raw"-style dynamic completion lists?
The text was updated successfully, but these errors were encountered: