Open borekb opened 5 years ago
Officially supported zsh completions can be found here.
Unfortunately, the completions for bash and zsh are implemented in an entirely different way, so there's no real great way to interop (that I'm aware of).
See #30 for discussion on some issues with parsing workspaces using package.json.
For anyone interested, I managed to make it work this way:
shopt
script somewhere in your $PATH.autoload bashcompinit && bashcompinit
source yarn-completion.bash
@dsifford if you don't mind I'll use this issue to gather pieces of information about the possible Zsh support. (Disclaimer: I know very little about how the completions work internally in either Bash or Zsh so won't probably be able to help myself.)
Current situation:
bashcompinit
as per the comment above.What I found in Zsh docs is simply this:
The function
bashcompinit
provides compatibility with bash’s programmable completion system. When run it will define the functions,compgen
andcomplete
which correspond to the bash builtins with the same names. It will then be possible to use completion specifications and functions written for bash.
I also have zsh-users/zsh-completions
installed which has this file in it, which seems to implement the compgen
and complete
functions as well. I'm not sure if it's loaded and how, and how it interacts with the built-in bashcompinit
from Zsh.
I also don't know how to troubleshoot issues with autocompletion – the suggestions are simply weird but there are no error messages anywhere.
@borekb Open up a new issue so others can find it easier. That way we might get lucky and have someone stumble upon it and help.
Re: your disclaimer -- I had no idea how bash completions worked and have never wrote a bash completion script in my life prior to making this one. It's tricky at first to understand, but I'm proof that it's possible. Don't sell yourself short.
If it was writing completions for a single known environment, maybe I could try to do that but this sounds like troubleshooting of some (delicate?) interactions / integrations between Zsh and Bash which I really don't think I'd be capable of 😄.
How about re-opening this issue? "Zsh support" as a title sounds pretty good to me.
Whoops, sorry... Thought this was the PR I commented on.
Yep, we can reopen this one. :+1:
Hi, I don't know how completions work internally and whether completions for Zsh are something completely different than completions for Bash but it would be awesome if this package worked in both shells. Is that technically possible?
BTW, these Yarn completions are way more advanced than anything else I have seen (for zsh at least), for example, parsing workspaces from
package.json
as per https://github.com/dsifford/yarn-completion/issues/29 is the right thing to do while most other completions don't support Yarn workspaces at all.