zsh-workers
 help / color / mirror / code / Atom feed
From: "Mikhail f. Shiryaev" <mr.felixoid@gmail.com>
To: zsh-workers@zsh.org
Subject: Questions regarding _hosts completion extension
Date: Mon, 27 Jun 2022 23:37:02 +0200	[thread overview]
Message-ID: <CAE1zrSGtrMWYKWaeY_p5yT2XfPs=cL_1KiCL6RFJ0J==ToAoYQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1918 bytes --]

Hello dear workers,
I have some questions regarding a stock _hosts completion function.

The original function, IMHO, has a few flaws that kind of difficult to
address without a heavy development, in particular:

   - It doesn't use cache features, so the shell instances don't share the
   state between them
   - It fills up the _cache_hosts only once at the first completion, and
   the only way to refresh it is `unset _cache_hosts`. A bit obscured
   - If one wants to extend the function with his values, then a way to go
   suggested on the Internet is defining a style `zstyle -e
   ':completion:*:hosts' hosts 'reply=(...)`. Unfortunately, it completely
   overrides the original function.
   - If `reply` executes any function or binary under the hood, the
   terminal hangs after each <tab> pressing.

I've spent some time developing a solution addressing all mentioned points.
It's the third implementation. The first one was done as an internal
product, and the two last are in my repository
https://github.com/Felixoid/zsh-hoco/blob/master/hoco.zsh. Features it has:

   - Users can set HOCO_FUNCTIONS array. Then its output will be split by
   spaces, tabs, and new lines, and used as the hosts' completion.
   - Uses the cache functions _store_cache, _retrieve_cache, and
   _cache_invalid. The cache content is shared between instances when
   `:completion:* use-cache` is set.
   - Functions or binaries are executed in the background and don't block
   the terminal.


I'd like to ask about your opinion if it makes sense to bring it to the
upstream. I am sure it still doesn't comply with the requirements for 100%
and can be improved. On the other hand, it brings many advantages. I'd like
to hear your opinion before trying to prepare a patch if it completely
breaks some rules though. For example, if async shouldn't be used in
completion.

What do you think?

Best regards,
Mikhail f. Shiryaev

[-- Attachment #2: Type: text/html, Size: 2364 bytes --]

             reply	other threads:[~2022-06-27 21:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27 21:37 Mikhail f. Shiryaev [this message]
2022-06-28  4:53 ` Eric Cook
2022-06-29  3:49 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAE1zrSGtrMWYKWaeY_p5yT2XfPs=cL_1KiCL6RFJ0J==ToAoYQ@mail.gmail.com' \
    --to=mr.felixoid@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).