completely icon indicating copy to clipboard operation
completely copied to clipboard

QUESTION: complete a term with a colon / :

Open kronn opened this issue 2 months ago • 2 comments

This project makes me almost completely happy. I want to write a completion for rspec, which is mostly painless. After being finished with my (opinionated) completion, I wanted to also complete the tags, which are tag:value-pairs. I generate the list with a small helper that returns a list that roughly looks like this:

js:false
js:true
sphinx:true
type:controller
type:feature
~js:false
~js:true
~sphinx:true
~type:controller
~type:feature

(naturally, there's more, but this shows the problem well enough)

The tag sphinx:true is easy, since it has the : inside the word. It gets completed in one <TAB>. The negated tags with the ~-prefix are also unproblematic.

For the others, the difference comes after the :. So it is printed but does not allow further completion. I can go back, escape the :, add another character and complete from there.

Let's just say that the ergonomics differ slightly between rsp<TAB>--tag sph<TAB><ENTER> and rsp<TAB>--tag ty<TAB><BACKSPACE>\:c<TAB><ENTER>

And yes, the last <TAB> completes type\:c to type:controller, removing my escape-hack and leaving me with the intended command. However, trying to complete type:c trigger the generic fallback of file-completion for c.

I realize that I do not have a completion-issue, but a shell-escape-issue (as so often when doing things in bash). Do you know of a solution for this? I have the feeling that the _completions_filter-function might be a place for a fix. How this potential fix is the propagated into the config-yaml is as unknown as the fix itself.

This is all I know now. Can you help or provide pointers for a PR I can create?

kronn avatar May 16 '24 16:05 kronn