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 are broken since 1.18 in zsh #13593

Closed
carlosala opened this issue Feb 4, 2022 · 31 comments · Fixed by #13597
Closed

Completions are broken since 1.18 in zsh #13593

carlosala opened this issue Feb 4, 2022 · 31 comments · Fixed by #13597
Labels
bug Something isn't working correctly

Comments

@carlosala
Copy link

Hi!
Completions in zsh doesn't work in the following way since 1.18.0 (1.17.3 works):

  • It completes the commands correctly (such as run, build, etc)
  • It doesn't complete the directories: if you write deno run and it doesn't show the folders and files.
@crowlKats
Copy link
Member

Probably related to updating to clap v3

@bartlomieju bartlomieju added the bug Something isn't working correctly label Feb 4, 2022
@carlosala
Copy link
Author

carlosala commented Feb 4, 2022

I found the problem. Updating clap_complete to 3.0.5 creates a correct zsh completion, I tested it compiling only changing that dependency.
Also with 3.0.4 works

@sant123
Copy link

sant123 commented Feb 17, 2022

The issue still persist in Deno v1.19.0 😞

@crowlKats
Copy link
Member

@sant123 It works fine for me

@sant123
Copy link

sant123 commented Feb 17, 2022

@crowlKats I just tested in Mac OS Monterey and Fedora 34 machine and still get the same :/

v1.17.3 works fine, also reinstalled oh my zsh and reboot both machines but is not working yet.

@remyrylan
Copy link

Same here, v1.17.3 worked, but completions in 1.18 and 1.19 do not work with zsh and macOS Monterey.

@carlosala
Copy link
Author

carlosala commented Feb 17, 2022

try to do a rm -r $ZSH/cache/completions and then re-open a terminal. It should work.
Do you have deno installed with package manager or just with the deno native installer?

@sant123
Copy link

sant123 commented Feb 17, 2022

I did the steps above but did not work either :/

I have deno installed by the native installer.

@remyrylan
Copy link

try to do a rm -r $ZSH/cache/completions and then re-open a terminal. It should work.
Do you have deno installed with package manager or just with the deno native installer?

Thank you @carlosala! rm -r $ZSH/cache/completions worked for me. Just to note, I'm also using the native installer.

@sant123
Copy link

sant123 commented Feb 17, 2022

Don't know what I'm doing wrong 🤔 I repeated the same steps in both computers without success

@carlosala
Copy link
Author

Are you using OMZ? If so, please continue the discussion in the issue about this in OMZ repo (it's linked above). Looks it's not a Deno issue, let's keep this issue clean.

@carlosala
Copy link
Author

carlosala commented Feb 19, 2022

For me it's also not working. I think that something changed and continues to not work.
It should not be Deno issue, but maybe deno should stay in clap 2.x

@crowlKats
Copy link
Member

@carlosala I'd rather avoid reverting clap to v2

@sant123
Copy link

sant123 commented Feb 21, 2022

I made a diff between Deno v1.17.3 and Deno v1.19.0 for the completion system and I noticed that the _files variable is missing in the generation:

image

Adding them manually fixes the issue 🤔

@crowlKats @carlosala

@sant123
Copy link

sant123 commented Feb 21, 2022

Please take a look at https://www.diffchecker.com/YYQhDZXL

Edit:
New link https://www.diffchecker.com/GmhE4CQb

@carlosala
Copy link
Author

Hi @crowlKats! Could you check the message above? Maybe there are some clap configurations that we can add to solve the issue

@mcornella
Copy link

Hi @crowlKats! Could you check the message above? Maybe there are some clap configurations that we can add to solve the issue

See #10166 (comment)

@crowlKats
Copy link
Member

Hey @carlosala & @mcornella, sorry for not having looked into this yet. i will look at it later today

@crowlKats
Copy link
Member

Apologies for another delay, looking into this now

@crowlKats
Copy link
Member

@mcornella not too familiar with completions, but from my understanding, zsh and friends allow for something to be defined to have multiple "hints" for the same thing? Or rather, should clap allow setting multiple ValueHints for a single argument?

@mcornella
Copy link

In Zsh you can use _alternative to specify different functions to run for the same argument. For example, for the open command it ends up suggesting files and URLs like so:

_alternative 'files: :_files' 'urls: :_urls'

completion suggestions for open

I think clap can implement that for Zsh but I don't know if fish supports that (ValueHint already seem to only be supported for zsh and fish).

In any case, file-only suggestions seems like a satisfactory solution, it's very rarely that you type a URL, so if you want to go with #10166 (comment) that works.

@sant123
Copy link

sant123 commented Apr 26, 2022

@crowlKats could you reopen this issue please?

@crowlKats crowlKats reopened this Apr 26, 2022
@sant123
Copy link

sant123 commented May 21, 2022

Tested on Fedora 36 and is working as expected. Somebody else is having issues in Linux?

@carlosala
Copy link
Author

Nope, it's fixed since 1.21 I think 👌🏻

@sant123
Copy link

sant123 commented May 26, 2022

@carlosala when you input some flags in the subcomand does still work the autocomplete?

deno run --allow-net mod.ts

For me it doesn't 😕

@carlosala
Copy link
Author

It's only working if I add something after --allow-net. It looks like allow-net is expecting some parameter. So deno run --allow-net foo <tab> is autocompleting the files for me, and without the argument to --allow-net nope.

@sant123
Copy link

sant123 commented Jun 3, 2022

Just tested with env, net and run and don't work 😕

@carlosala carlosala reopened this Jun 3, 2022
@crowlKats
Copy link
Member

for me this works as expected

@sant123
Copy link

sant123 commented Jan 10, 2023

@crowlKats please type:

deno run --allow-net

And hit tab. Does it autocomplete the files in the current working directory?

@crowlKats
Copy link
Member

no, youa re right, it does not; I was pressing space after allow-net which would work

@lucacasonato
Copy link
Member

@marvinhagemeister is unable to reproduce this in the latest releases. I am going to close this issue. If you still run into this (or other completion related issues), please open a new issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants