There is no simple way to get the behavior you're looking for.
At best, you can define your own function named TabExpansion2
and either fully implement tab completion yourself (definitely not recommended) or filter the results returned from the default implementation of TabExpansion2
.
I recall discussing this idea recently, I thought there might even be an open issue, but I didn't see it after a quick search here.
I don't know the exact history, but at one point we did implement the behavior you're wanting. It did break some tests, and I think some people preferred seeing effectively useless completions over no completions, perhaps it was reassuring that completions were still working.
At any rate, I think it's a reasonable feature request, I'd suggestion opening an issue if you can't find one.