Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]: sourcing completion when generated in the atpull hook #147

Open
yodahuang opened this issue Dec 22, 2021 · 8 comments
Open

[bug]: sourcing completion when generated in the atpull hook #147

yodahuang opened this issue Dec 22, 2021 · 8 comments
Labels
bug Something isn't working

Comments

@yodahuang
Copy link

yodahuang commented Dec 22, 2021

Issue description

The generated _foo_bar completion file is being ignored by zinit.

E.g. when running zinit update kubectl_completion (see my config for the setup that is previously working),

[update] Continuing with the update because run-atpull'' ice given.
No files for compilation found.
Warning: ∞zinit-compile-plugin-hook hook returned with 1

Using zinit update kubectl_completion -u -r does not help.

zinit config

zinit lucid wait has"kubectl" for \ 
  id-as"kubectl_completion" as"completion" \ 
  atclone"kubectl completion zsh > _kubectl" \
atpull"%atclone" run-atpull zdharma-continuum/null 

zinit version or commit ID

9ee45d6

zsh version

5.8

host info

OSTYPE=linux-gnu CPUTYPE=x86_64 MACHTYPE=x86_64 5.4.0-1060-aws VERSION="18.04.6 LTS (Bionic Beaver)" ID=ubuntu

@yodahuang yodahuang added 🎲 triage bug Something isn't working labels Dec 22, 2021
@yodahuang yodahuang changed the title 🐞 bug: Completion is not sourced when generated from atpull hook. 🐞 bug: Completion is not sourced when generated from atpull hook. Dec 22, 2021
@vladdoster
Copy link
Member

Thanks for reporting this @yodahuang! I'll take a look at this later tonight.

@lljbash
Copy link

lljbash commented Dec 23, 2021

Same for me.

My config:

zinit wait lucid depth=3 as"completion" blockf from"gh-r" light-mode for \
    mv"ripgrep* -> ripgrep" cp"ripgrep/comp*/_rg -> _rg" sbin"ripgrep/rg" \
    atclone"rm -rf ripgrep/comp*" atpull'%atclone' \
        BurntSushi/ripgrep

Test result:

1e6bdf0: broken

Downloading BurntSushi/ripgrep…
(Requesting `ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz'…)
######################################################################## 100.0%
ziextract: Unpacking the files from: `ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz'…
ziextract: Successfully extracted and assigned +x chmod to the file: `ripgrep-13.0.0-x86_64-unknown-linux-musl/rg'.
'ripgrep-13.0.0-x86_64-unknown-linux-musl' -> 'ripgrep'
Warning: ∞zinit-mv-hook hook returned with 1
'ripgrep/complete/_rg' -> '_rg'
Warning: ∞zinit-cp-hook hook returned with 1
No files for compilation found.
Warning: ∞zinit-compile-plugin-hook hook returned with 1
bin-gem-node annex: Created the rg shim and set +x on the rg binary

d82c613: good

Downloading BurntSushi/ripgrep…
(Requesting `ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz'…)
######################################################################## 100.0%
ziextract: Unpacking the files from: `ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz'…
ziextract: Successfully extracted and assigned +x chmod to the file: `ripgrep-13.0.0-x86_64-unknown-linux-musl/rg'.
'ripgrep-13.0.0-x86_64-unknown-linux-musl' -> 'ripgrep'
'ripgrep/complete/_rg' -> '_rg'
No files for compilation found.
bin-gem-node annex: Created the rg shim and set +x on the rg binary
Installed 1 completions. They are stored in the $INSTALLED_COMPS array.

@vladdoster
Copy link
Member

oof, we broke zinit with a documentation update... lol. Looking into this now.

@gotgenes
Copy link

gotgenes commented Mar 9, 2022

I just ran into this issue trying to use completions for poetry

zinit ice as"completion" id-as"poetry-completion" has"poetry" run-atpull \
    atclone"poetry completions zsh > _poetry" atpull"%atclone"
zinit light zdharma-continuum/null

I can see the file at ~/.zinit/plugins/poetry-completion/_poetry, however, it's not sourced and used for completions.

oof, we broke zinit with a documentation update... lol. Looking into this now.

@vladdoster Would you be willing to share any more information regarding this? Perhaps the suspect lines of code, or at least the commit or PR?

EDIT: I missed the commits listed by @lljbash above. So it seems like this was introduced in #112.

Is there a known workaround, in the meantime?

@yodahuang
Copy link
Author

There's a workaround at #172 (comment), which basically says "ok zinit is not souceing the completion file for me, let me run zinit creinstall myself".

@vladdoster
Copy link
Member

@gotgenes

I think your recipe for poetry completion is incomplete.

Try this:

zi for \
    as'completion' \
    atclone'poetry completions zsh > _poetry' \
    atpull'%atclone' \
    blockf \
    has'poetry' \
    id-as'python-poetry/poetry' \
    nocompile \
  zdharma-continuum/null

@gotgenes
Copy link

@vladdoster Thanks for your help! I believe the nocompile was critical here, but also I added the as'completion'. This now works for me:

zinit ice \
    as"completion" \
    id-as"poetry-completion" \
    has"poetry" \
    atclone"poetry completions zsh > _poetry" \
    atpull"%atclone" \
    run-atpull \
    nocompile
zinit light zdharma-continuum/null

@mustaqimM
Copy link

mustaqimM commented May 3, 2022

I believe the nocompile was critical here

@vladdoster How come this is needed? I also came across this with starship:

zi from"gh-r" bpick"*linux-gnu.tar.gz" nocompile fbin"starship" \
  atclone"./starship init zsh > init.zsh; zcompile init.zsh; \
  ./starship completions zsh > _starship" atpull"%atclone" for \
  "starship/starship"

The completion file _starship wasn't being linked until I added nocompile

@vladdoster vladdoster changed the title 🐞 bug: Completion is not sourced when generated from atpull hook. [bug]: sourcing completion when generated in the atpull hook May 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants