-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
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
Load asdf completions #8837
Load asdf completions #8837
Conversation
@jthegedus may also be interested. |
Thanks @filipegiusti I am indeed interested. |
plugins/asdf/asdf.plugin.zsh
Outdated
fpath=($ASDF_COMPLETIONS $fpath) | ||
autoload -Uz compinit && compinit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be performed for any brew installed version of asdf
as Homebrew has it's own setup for completions, which I believe I implemented in https://github.com/Homebrew/homebrew-core/blob/6e728e63ab37243b6832d2995e7efdbac7f0d612/Formula/asdf.rb#L25 (the correctness of my implementation needs to be validated).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe #L8 can be removed also as the Homebrew install should now handle the completions.
#L8 needs to be modified to conform to https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with brew, so I may be completely wrong here.
The documentation suggest that FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
is needed to install all zsh completions when using brew, not just one plugin. ZSH brew plugin also doesn't do anything related to completions.
I think that your changes on brew formulae for asdf should sync link the _asdf file and as users of brew follow the instructions on https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh, it just work ®.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a few changes to not add the completion code on brew, however I can't test it on brew.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a suspicion that we should also be handling here different versions of asdf. Which asdf version added the zsh completion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can perform a test of brew tomorrow, though am also not particularly familiar.
0.7.6
was the last version this plugin properly supports.
0.7.8
added the ZSH completions properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me for supporting asfd 0.7.8
and above. If backwards compatibility is required, then asdf 0.7.6
was the last version that relied upon the Bash completions
Running compinit again in the plugin will cause duplicate work and slow down the startup significantly. My suggestion in #8779 (comment) was to change fpath=("$ASDF_DIR/completions" $fpath)
autoload -Uz _asdf
compdef _asdf asdf That said, if the bash completion is present in all present asdf versions, the proper solution is to use it in conjunction with bashcompinit, which is already loaded by OMZ, so asdf-vm/asdf#692 shouldn't be an issue here. I'm closing this then, in wait of new information. |
@mcornella our goal with this plugin would be to use the ZSH completions and not rely on the bash completions. The confusion in that linked issue is people expecting this to load the ZSH completions with compinit, but getting the bash completions and not having the deps of our bash completions script. Without the call to compinit in this plugin, would this work without users having to call compinit after they initialise OMZ and it's plugins? My understanding was compinit ran before any plugins and to get the effect we want we would need to run it again in the plugin here. |
Soooooo this was closed and the only solution for now is to either source asdf completions BEFORE o-m-z without using the plugin or using the bash completions? |
As I said, the bash completion (which is perfectly functional) is present in all versions, unlike the zsh one. So it makes sense to keep it that way. |
@Quintasan That's exactly what I do https://github.com/jthegedus/dotfiles/blob/c58a76734caa2d7bbba6acdeadcc439326dde0bb/dotfiles/.zshrc#L71 I agree not ideal. @mcornella I feel
Is not a sound reason to avoid solving for ZSH native completions. The fact the Bash works and the I hope there's a solution to this in the future, but until then I agree with @mcornella in using the Bash completions if you use this plugin. |
Argh! This should work out of the box, I've already wasted an hour trying to get this to work |
Came here from https://asdf-vm.com/#/core-manage-asdf Confused 😵 I now have:-
To get things working. |
@gaving The way I understand this PR is, you have to specifically load the PR in omz. Its not included by default. Try |
@gaving what I suggest here - #8837 (comment) - is this:
The reason the documentation does not just say "Do X" is because there are many different ways to manage the ZSH completions depending on Shell manager (if one is used at all). You shouldn't need to run Perhaps we should list each shell manager's instructions in the docs, though as solution in the plugin would be ideal, perhaps this PR can be modified to perform these suggestions #8837 (comment) |
Ah thanks, thats much cleaner!
…On Thu, 4 Mar 2021 at 22:09, James Hegedus ***@***.***> wrote:
@gaving <https://github.com/gaving> try what I suggest here - #8837
(comment)
<#8837 (comment)>
The reason the documentation does not just say "Do X" is because there are
many different ways to manage the ZSH completions depending on Shell setup.
You shouldn't need to run autoload etc with this OMZSH plugin as long as
you include the Shell completions with fpath before the OMZSH plugins are
listed.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8837 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAKVXOK64HF4AJFRNHCKW3TCAAKXANCNFSM4MKFUPIA>
.
|
I tried exactly #8837 (comment)
and still got the error Version:
|
Use my own asdf loading snippet to work around ohmyzsh/ohmyzsh#8837
@fxsalazar Check if |
Same result. |
What did you do differntly? If Also, you said
But |
fpath=($HOME/.asdf/completions $fpath)
plugins=(
asdf
)
source $ZSH/oh-my-zsh.sh
# . $HOME/.asdf/asdf.sh
# fpath=(${ASDF_DIR}/completions $fpath)
# autoload -Uz compinit && compinit ==>
I did re-launch the terminal; cleaned the .zcomp* files. |
relates to ohmyzsh/ohmyzsh#8837
@jthegedus do you know if the docs on asdf-vm.com are outdated or not? |
@devinrhode2 The docs were written when this PR was pending, not closed. I am not a ZSH user so not sure if the issue has been resolved elsewhere or not. Happy to update the docs should that caveat no longer be the case. |
Seems like it's still buggy in zgen |
The completion is working fine for me (oh-my-zsh plugin on macos) |
Hey guys! The completions for ZSH is not yet supported by asdf plugin. I opened a PR here 6 months ago to resolve this. TBH, I'm not sure to perfectly understand all the issues around the ZSH completions problems. Is my PR resolving the issues? Is my PR not relevant? |
This is fixed in the asdf + direnv plugin redxtech/zsh-asdf-direnv#10 |
@carlosala Has this issue been corrected by your changes here 278bcfc? asdf is still referencing this issue in its zsh and git guide https://asdf-vm.com/guide/getting-started.html#_3-install-asdf. |
It should work, yes! |
Standards checklist:
Other comments:
May fix asdf-vm/asdf#692
It's a short term solution for #8779
Fix #8820
Tagging listed Maintainer of OMZ asdf plugin: @RobLoach