carapace
carapace copied to clipboard
cache: add short lived cache
Unlike other shells bash does not enter a completion mode (caches the completion results) and thus invokes the same callback multiple times during <TAB> press. Add an implicit cache so that the same call within a short time will be returned directly to improve performance.
- workdir must be the same
- arguments/command line must be the same
- just one cache file, overwrite if anything has changed (or last write time exceeded timeout)
- try to get a lock on the file when writing and simply skip if not gotten it (though this should normally not happen)