You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Override complete -x/complete -f when no completion source provides no completions #5238
As a possible remedy for #5237, instead of disabling file-based ghosted completions when -x/-f is enabled, how about overriding the -x/-f flag if there are no completions for the commandline buffer at the current cursor token, so that default sources can be allowed to kick in?
That would downgrade the exclusive flag to a hint rather than an order, and means cases like #5236 wouldn't be as bad without explicitly-coded workarounds. The experience for non-perfect completions (and is there such a thing?) would instead never be worse than no completions at all.
To steal the example from #5237, but with hypothetical results:
touch foo foo1 foo2
complete-ccat-ax bar
cat fo<TAB># should show foo, foo1, and foo2
This should realize that no completions by the previous exclusive provider aren't going to cut it here and then provide default completions.
There are of course cases where -x in a completion script is spot-on that should be considered, for example (and I don't know if it's the case), if dd's completion specifies -f that's because dd is never given an undecorated filename as a parameter, come hell or high water (watch me be proved wrong!), and users attempting to autocomplete a (undecorated) filename will be "warned" by the error tone/bell that they're trying something incorrect...
So maybe we should allow a -X/-F to keep the current behavior and change -x/-f to degrade to a recommendation that loses its effect if no completions are provided?
Activity
faho commentedon Oct 8, 2018
@mqudsi: That's the reverse of #112, which we changed on purpose.
Let's keep any discussion of how to solve the problem with suggestions in #5237.