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

[maint/feature]: Understand/improve the interaction between as"completion" and explicit download pick #310

Closed
jankatins opened this issue Jun 14, 2022 · 4 comments

Comments

@jankatins
Copy link
Contributor

jankatins commented Jun 14, 2022

Summary

It seems the interaction between as"completion" and an explicit download pick is surprising, as it seems to require a mv + pick ice as well (Why? No idea, maybe because it doesn't follow the _<package-id> logic?):

(from https://github.com/zdharma-continuum/zinit/pull/227/files#r866821730

zinit for as"completion" from"gh-r" id-as'tldr-completion/gh-r' bpick"completions_zsh" mv"completions_zsh -> _tldr_ghr" pick"_tldr_ghr" @dbrgn/tealdeer

In that case, a simple

zinit for as"completion" from"gh-r" id-as'tldr-completion/gh-r' bpick"completions_zsh"  @dbrgn/tealdeer

wasn't enough to make zinit link the completion into the completion dir, it needs both the mv and the pick (only the pick with the downloaded name is also not enough).

Comment by @vladdoster:

iirc you shouldn't need the move ice, but I forget why. It was something that seemed somewhat magical.
This seems a bit odd, if its a completion, you shouldn't need to source it as well via the pick ice ... right?

Proposed fix

No idea

@jankatins
Copy link
Contributor Author

Full session (in ~/.local/share/zinit/completions, so the rm works):

[14:40:07] λ  rm -rf _tldr_ghr && zinit delete tldr-completion/gh-r -y

Done (action executed, exit code: 0)

[14:40:19] λ  zinit for as"completion" from"gh-r" id-as'tldr-completion/gh-r' bpick"completions_zsh"  @dbrgn/tealdeer

Downloading dbrgn/tealdeer… (at label: tldr-completion/gh-r…)
(Requesting `completions_zsh'…)
############################################################################################################################################################################################################ 100.0%
ziextract: WARNING: didn't recognize the archive type of `completions_zsh'  }(no extraction has been done).%f%b
No files for compilation found.
Warning: ∞zinit-compile-plugin-hook hook returned with 1

[14:40:26] [1] ✗  ls -la |grep tldr

[14:40:29] [1] ✗  rm -rf _tldr_ghr && zinit delete tldr-completion/gh-r -y

Done (action executed, exit code: 0)

[14:40:35] λ  zinit for as"completion" from"gh-r" id-as'tldr-completion/gh-r' bpick"completions_zsh" mv"completions_zsh -> _tldr_ghr"  @dbrgn/tealdeer

Downloading dbrgn/tealdeer… (at label: tldr-completion/gh-r…)
(Requesting `completions_zsh'…)
############################################################################################################################################################################################################ 100.0%
ziextract: WARNING: didn't recognize the archive type of `completions_zsh'  }(no extraction has been done).%f%b
renamed 'completions_zsh' -> '_tldr_ghr'
No files for compilation found.
Warning: ∞zinit-compile-plugin-hook hook returned with 1

[14:40:42] [1] ✗  ls -la |grep tldr

[14:40:46] [1] ✗  rm -rf _tldr_ghr && zinit delete tldr-completion/gh-r -y

Done (action executed, exit code: 0)

[14:40:50] λ  zinit for as"completion" from"gh-r" id-as'tldr-completion/gh-r' bpick"completions_zsh" mv"completions_zsh -> _tldr_ghr" pick"_tldr_ghr" @dbrgn/tealdeer

Downloading dbrgn/tealdeer… (at label: tldr-completion/gh-r…)
(Requesting `completions_zsh'…)
############################################################################################################################################################################################################ 100.0%
ziextract: WARNING: didn't recognize the archive type of `completions_zsh'  }(no extraction has been done).%f%b
renamed 'completions_zsh' -> '_tldr_ghr'
Note: Compiling: _tldr_ghr… OK.
Installed 1 completions. They are stored in the $INSTALLED_COMPS array.

[14:41:00] λ  ls -la |grep tldr
lrwxrwxrwx 1 jan jan   69 Jun 14 14:41 _tldr_ghr -> /home/jan/.local/share/zinit/plugins/tldr-completion---gh-r/_tldr_ghr

[14:41:03] λ  rm -rf _tldr_ghr && zinit delete tldr-completion/gh-r -y

Done (action executed, exit code: 0)

[14:41:46] λ  zinit for as"completion" from"gh-r" id-as'tldr-completion/gh-r' bpick"completions_zsh" pick"completions_zsh" @dbrgn/tealdeer

Downloading dbrgn/tealdeer… (at label: tldr-completion/gh-r…)
(Requesting `completions_zsh'…)
############################################################################################################################################################################################################ 100.0%
ziextract: WARNING: didn't recognize the archive type of `completions_zsh'  }(no extraction has been done).%f%b
No files for compilation found (pick-ice didn't match).
Warning: ∞zinit-compile-plugin-hook hook returned with 1

[14:42:02] [1] ✗  ls -la |grep tldr

@vladdoster
Copy link
Member

Can you choose if this is either a feature or maintenance and recreate this issue using the appropriate issue template?

@vladdoster
Copy link
Member

Btw the completion isn’t recognized due to this line, no?

reply=( "${ZINIT[PLUGINS_DIR]}/$uspl"/**/_[^_.]*~*(*.zwc|*.html|*.txt|*.png|*.jpg|*.jpeg|*.js|*.md|*.yml|*.ri|_zsh_highlight*|/zsdoc/*|*.ps1)(DN) )

@jankatins
Copy link
Contributor Author

I've no clue if this should be considered a bug or a feature or even "just" some missing documentation (= behaviour is fine, works as intended, just needs to be documented), I just opened this issue because you said it was strange in #227.

I haven't looked what is preventing this combination to be recognised as a completion, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants