Deno: zsh completion is broken

Created on 9 Nov 2019  Â·  22Comments  Â·  Source: denoland/deno

Getting this error:

/usr/local/etc/zsh_completion.d/deno.zsh:478: no matches found: _deno__[SCRIPT]_commands

bug cli

Most helpful comment

@meSingh try the following commands:

mkdir ~/.oh-my-zsh/custom/plugins/deno
deno completions zsh > ~/.oh-my-zsh/custom/plugins/deno/_deno

After this add deno plugin under plugins tag in .zshrc file.

All 22 comments

How did you install the deno / the completions?

@hayd exported deno completions zsh into /usr/local/etc/zsh_completion.d/deno.zsh, then sourced
/usr/local/etc/zsh_completion.d/deno.zsh in ~/.zshrc

And I tried adding that folder to fpath, since I am using oh-my-zsh, I tried placing that file under ~/.oh-my-zsh/comletions and functions folders, even added the deno command output directly to .zshrc, still getting the same issue

@KluVerKamp not long ago we had another CLI refactor, is this issue still persisting?

@bartlomieju I have just checked, it works now!

FYI
On my installation (Debian 10) I solved the problem by running:

deno completions zsh > /usr/local/share/zsh/site-functions/_deno

This solved the issue immediately. :partying_face:

I'm currently not able to get deno completions to work:

deno completions zsh > /tmp/deno_zsh
source /tmp/deno_zsh
>>> _arguments:comparguments:312: can only be called from completion function
deno completions bash > /tmp/deno_bash
source /tmp/deno_bash
>>> /tmp/deno_bash:649: command not found: complete

Both run with:
zsh 5.1.1 (x86_64-ubuntu-linux-gnu)
deno 1.0.5

It's working in bash, but I'm not terribly inclined to switch tbh =)

@bartlomieju could this be some kind of regression bug?

Any help much appreciated!

Getting this error on :

deno 1.0.5
v8 8.4.300
typescript 3.9.2
zsh 5.4.2 (x86_64-apple-darwin17.3.0)

➜ source ~/.oh-my-zsh/custom/plugins/deno.zsh
_arguments:comparguments:325: can only be called from completion function

any change in this error for completions ?

@meSingh same error

I'm not immediately sure what's the problem. Reopening the issue

@meSingh try the following commands:

mkdir ~/.oh-my-zsh/custom/plugins/deno
deno completions zsh > ~/.oh-my-zsh/custom/plugins/deno/_deno

After this add deno plugin under plugins tag in .zshrc file.

Thanks @vinschess, that worked for me!

@vinschess this is worked for me too. thank you .

@vinschess thanks a lot, this fixed my issue.

Any idea why this works, while the documented way (generate the file and source it) does not?!

@stefanpl - I haven't tried the documented way, but this is how you put any completion function plugin in the ZSH.
For more understanding check this blog.

@meSingh try the following commands:

mkdir ~/.oh-my-zsh/custom/plugins/deno
deno completions zsh > ~/.oh-my-zsh/custom/plugins/deno/_deno

After this add deno plugin under plugins tag in .zshrc file.

Added a PR to update doc with this information:
https://github.com/denoland/deno/pull/6298

@vinschess @meSingh please be aware that oh-my-zsh !== zsh. There are people (albeit few I assume) who are using zsh without the framework behind it. They won't have access to the plugin mechanism.
The documentation should imo:

  • most importantly: provide a way to make it work in plain zsh (still unclear to me)
  • optionally, provide a way for oh-my-zsh

Thanks @stefanpl for pointing it out, I assumed almost everyone uses zsh with the framework.

I will update the PR accordingly.

@stefanpl have you tried in plain vanilla zsh? is it not working in that?

for people who are using antigen like I am, the process remains the same, just change the path to
~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins instead of ~/.oh-my-zsh and then add antigen bundle deno to the .zshrc to load the plugin. enjoy!

if #6998 doesn't work for vanilla zsh users,

  • mkdir -p ~/.zsh/completion
  • deno completions zsh > ~/.zsh/completion/_deno
  • add fpath+=(~/.zsh/completion) at the top of .zshrc
  • restart terminal or source path/to/.zshrc
Was this page helpful?
0 / 5 - 0 ratings

Related issues

doutchnugget picture doutchnugget  Â·  3Comments

benjamingr picture benjamingr  Â·  3Comments

kitsonk picture kitsonk  Â·  3Comments

watilde picture watilde  Â·  3Comments

xueqingxiao picture xueqingxiao  Â·  3Comments