Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Help Request/Bug Report: comparguments causes _arguments to fail in certain cases
- X-seq: zsh-users 24852
- From: Dan Arad <dan1994@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Help Request/Bug Report: comparguments causes _arguments to fail in certain cases
- Date: Mon, 18 May 2020 09:20:49 +0300
- Cc: Zsh Users <zsh-users@xxxxxxx>
- In-reply-to: <CAH+w=7YBwZRQjg3J=PYdzwwSN8RPGfm-DGO-cERJOa8rad2hiA@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAPPzoJDB3jB7pHUfE7UjY09OHk+r_pgLeYxuaoXhMFGHf-3UCQ@mail.gmail.com> <20200503165802.6540ad48@tarpaulin.shahaf.local2> <CAPPzoJDyK35bSMTyYKovEbRZNhDpKs1aeY2ZRjzBTxgdgCuGww@mail.gmail.com> <20200504131830.3572e317@tarpaulin.shahaf.local2> <CAPPzoJC6MYg8CEqsmLRPvPRYPLYP+dJxA4BCR0Cue6xTdZ9Q9g@mail.gmail.com> <20200505164934.3f6b7f42@tarpaulin.shahaf.local2> <CAPPzoJDeGo_gzn9DFCv1Zd=m6bDO34AK1K-KSmxwu-9mQHcKtg@mail.gmail.com> <20200507204007.7487332d@tarpaulin.shahaf.local2> <CAPPzoJD-DqObF630EAF63Ptn-=ftiEmnywSb-w6KmfhBQ7DCkw@mail.gmail.com> <20200516204840.3a302225@tarpaulin.shahaf.local2> <CAPPzoJDL_vpLHe5iNgiNP6desAt_SmwEHLurY0W-JN4YrwqvbA@mail.gmail.com> <CAPPzoJBWJ8-yf1f-3ibP2BrJLOgy5k0=YiUf-B=763EKLHFViw@mail.gmail.com> <CAH+w=7bOUOqR3jcsfR4ajxb1COE=mngR3WhSo0iUF9xXMJpidw@mail.gmail.com> <CAH+w=7YBwZRQjg3J=PYdzwwSN8RPGfm-DGO-cERJOa8rad2hiA@mail.gmail.com>
Thanks for the great clarifications! I'll try to stick to the correct
technical terms.
This isn't happening because of an unknown command, it's because the
> historic behavior of _normal is to return all files when none match
> the specific completer.
...
However, nothing will have been "compadd"ed by _python at the point at
> which it calls _normal. Anything that gets added is being added as
> consequence of calling _normal, not as a consequence of calling
_python.
I suspected as much, but I'm new to zsh and completion, so I had some hard
time following the debug logs and figuring this out.
_python_or_script() {
> _python_script_words_backup
> _python "$@" && _compskip=all
> }
> compdef _python_or_script python
This works like a charm!
The only thing I did different is to use the `#compdef -p` form at the
beginning of the file so I could give the same pattern as that of the
`_python` function.
> and not before. I also use `_compskip=all`
>
> That doesn't actually do very much once you are beyond -first-. It
> aborts the current level of _dispatch but doesn't prevent the outer
> _default that called _python from continuing on into -default-, which
> I think you'll find to be the place your extra matches are coming
> from.
This `_compskip` prevents the inner `_dispatch` from calling the
`_python_script` function more than once.
An example I've seen, is with the command line `python .vscode/ps.py` (I
use the .vscode directory as a place for temporary files as it is git
ignored).
In this case, without `_compskip=all`, the inner `_dispatch` calls
`_python_script` once with `service=.vscode/ps.py` and once with
`service=ps.py`.
In my case this doubles the time to produce completions which may be
critical depending on the way the user has written his script.
To conclude, I would really like to thank everybody who took part in this
discussion.
This is my first open source project, and I was really hoping to provide a
good user experience.
It was a great experience for me to have such a productive conversation,
and I really appreciate the time you've put into providing detailed answers
in a welcoming manner.
Have a great day!
Dan
On Mon, May 18, 2020 at 1:14 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
wrote:
> On Sun, May 17, 2020 at 3:12 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
> wrote:
> >
> > aborts the current level of _dispatch but doesn't prevent the outer
> > _default that called _python from continuing on into -default-, which
>
> Typo, that should say "... the outer _dispatch that ..."
>
--
Dan Arad
dan1994@xxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author