zsh-users
 help / color / mirror / code / Atom feed
From: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: More-verbose tab-completion idiom?
Date: Thu, 17 Mar 2022 17:38:54 -0400	[thread overview]
Message-ID: <YjOqbt6Vlcr8Puyw@fullerene.field.pennock-tech.net> (raw)
In-Reply-To: <CAH+w=7Y6XtGs_8k4Uw4vv2=Apo4jkR1TPxOpTEGYAyz_8TfRGA@mail.gmail.com>

On 2022-03-17 at 13:44 -0700, Bart Schaefer wrote:
> Are the key-value pairs at least all on one line each?  Just choosing
> a json file that's lying around on my Ubuntu:

Yes, yes they are.
For now.  And I'm in a position to chat with the tool maintainer and try
to make sure they stay that way.

> json2hash () {
>   zmodload zsh/mapfile
>   setopt localoptions extendedglob
>   # Might have to undo gmail line wrapping here
>   typeset -gA $1=(
> ${(z)${(@)${(f)mapfile[$2]}:#[{}]}/(#b)([^:]#):(*)/${(Q)match[1]}
> ${(q)${(z)${match[2]%,}}}} )
> }
> json2hash scopes /usr/share/unity/client-scopes.json
> typeset -p scopes

Switching from `jq` to this:

  described_contexts+=("${nctx//:/\\:}:${${${${(@M)${(f)mapfile[$nats_ctxdir/$nctx.json]}:#[[:space:]]##\"description\":*}#*: \"}%,}%\"}")

means that the time to complete, across 35 files, drops from "a few
seconds where things appear to have hung" to "faster than I can notice",
so I am going to publish a version using this, and most of Daniel's
suggestions, in a few minutes.  I just have to switch from
"extra-verbose" to "verbose" simply because of the difference in
overhead now.

Thank you!

-Phil


  reply	other threads:[~2022-03-17 21:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17  0:26 Phil Pennock
2022-03-17  0:50 ` Daniel Shahaf
2022-03-17  1:26   ` Phil Pennock
2022-03-17  1:20 ` Bart Schaefer
2022-03-17  1:24   ` Bart Schaefer
2022-03-17  2:21   ` Phil Pennock
2022-03-17 16:30     ` Daniel Shahaf
2022-03-17 20:44     ` Bart Schaefer
2022-03-17 21:38       ` Phil Pennock [this message]
2022-03-18  0:28         ` Daniel Shahaf
2022-03-18  1:16           ` Phil Pennock

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=YjOqbt6Vlcr8Puyw@fullerene.field.pennock-tech.net \
    --to=zsh-workers+phil.pennock@spodhuis.org \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-users@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).