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

Completions for zsh is not working #496

Closed
wesleycoder opened this issue Jul 10, 2019 · 7 comments · Fixed by #772
Closed

Completions for zsh is not working #496

wesleycoder opened this issue Jul 10, 2019 · 7 comments · Fixed by #772
Labels

Comments

@wesleycoder
Copy link

Completions for zsh are not working propperly.
I'm getting the following output on my zsh startup script related to the loading of the source <(volta completions zsh):
_arguments:comparguments:325: can only be called from completion function

Using volta@0.5.5 on MacOS Mojave with zsh@5.7.1 (x86_64-apple-darwin18.2.0)

@chriskrycho
Copy link
Contributor

Thanks for reporting this! One of us will try to dig in soon!

As a bit of help for us, and just to double check: you're running exactly the command source <(volta completions zsh)? What happens if you save them to a file and then source that as part of your .zshrc? (Trying to see if this is a function of sourcing it this way vs. outputting to a file.)

@wesleycoder
Copy link
Author

I've done exactly this and the behavior is the same.
If you think it would help I could make a gist with my entire config without the sensitive data and link here tomorrow.

@wesleycoder
Copy link
Author

But there's plenty of scripts being loaded in there and I don't know if it would be easy to isolate the problem from it

@chriskrycho
Copy link
Contributor

No worries, I think it’s unlikely that’s the issue, but if we can’t otherwise reproduce it we’ll ask! It’s more likely there’s an issue in either our code or the upstream dependency which we use to generate the completions!

@hathamneh
Copy link

hathamneh commented Oct 11, 2019

I'm having the same problem when sourcing the completion script, I get this error:

_arguments:comparguments:319: can only be called from completion function

I've got the same issue on Zorin OS 15 and Ubuntu 18.04

@charlespierce
Copy link
Contributor

I was able to reproduce this on my Mac. Based on some discussion in this issue kubernetes-sigs/kind#522, while unrelated to how we generate completions, it looks like zsh takes a different approach to completions. Instead of sourcing the generated script directly, you save it to a file named _volta in the fpath. On my machine, I can do:

volta completions zsh > /usr/local/share/zsh/site-functions/_volta

And then the completions appear to work. That said, there are still some issues with the generated completions, at least I ran into an issue where doing volta list and then hitting tab caused an error:

volta list (eval):1: command not found: all
_arguments:453: command not found: ,

So there's still something that's not being fully generated correctly.

@FichteFoll
Copy link

FichteFoll commented May 6, 2024

Apparently, in zsh you can do the following to allow lazy-evaualtion of the completions inside zshrc: clap-rs/clap#4734

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

Successfully merging a pull request may close this issue.

5 participants