Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Smarter matcher-list: skip previous sets



On May 19, 10:50am, Daniel Hahler wrote:
}
} But is it necessary then to call the completion function multiple times?
} Couldn't the matchers just loop over the result that has been collected
} once?

Every (completer, matcher) pair might call different completion functions
or make different changes to the context.  _main_complete doesn't know
what the internals of a completer are going to do, so it has to make the
call for each possible pair.  It does attempt to break out of the loops
as soon as the exit status indicates that matches have successfully been
generated.

} If I understand it correctly, the possible results would be the same
} every time?

No, not necessarily.

} Where is the $_matcher used?
} Is it in Completion/Base/Core/_description, in the opts to compadd?

Yes, but also in _path_files.  More often _matcher_num is referenced,
so that completers that don't care about _matcher can become no-ops
after the first attempt.  Cf. Completion/Base/Completer/_menu 

} What would be a possible solution to improve handling with many
} completers/matchers?

There's no generic solution, this was discussed in agonizing detail
back when the completer/matcher loops in _main_complete (and in _prefix
and in _ignored) were put in place.  It's up to individual completers
or completion functions to avoid doing redundant work, which may be a
point that (a) should be made in the doc somewhere and (b) has been
forgotten in more recently-invented functions.



Messages sorted by: Reverse Date, Date, Thread, Author