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

ZSH completions don't work #4114

Closed
7ocb opened this issue Nov 20, 2021 · 11 comments
Closed

ZSH completions don't work #4114

7ocb opened this issue Nov 20, 2021 · 11 comments

Comments

@7ocb
Copy link

7ocb commented Nov 20, 2021

I did a "pio system completion install --shell zsh", and when I enter "pio" and hit tab, nothing is completed.

It's installed:

❯ grep -A 10 "compdef pio" .zshrc
#compdef pio
_pio() {
eval $(env COMMANDLINE="${words[1,$CURRENT]}" _PIO_COMPLETE=complete-zsh pio)
}
if [[ "$(basename -- ${(%):-%x})" != "_pio" ]]; then
compdef _pio pio
fi

Versions:

❯ pio --version
PlatformIO Core, version 5.2.4a4
❯ zsh --version
zsh 5.8 (x86_64-pc-linux-gnu)
❯ uname -a
Linux /hostname/ 5.15.2-arch1-1 #1 SMP PREEMPT Fri, 12 Nov 2021 19:22:10 +0000 x86_64 GNU/Linux
❯ python --version
Python 3.9.7

Note:

❯ env COMMANDLINE="pio" _PIO_COMPLETE=complete-zsh pio

outputs nothing.

@ivankravets
Copy link
Member

Thanks for the report! We totally rewrote tab completion support. Please remove any code related to pio from your .zshrc before installing new code.

  1. Remove pio related code from ~/.zshrc
  2. Upgrade to the latest PIO Core via pio upgrade --dev
  3. pio system completion install zsh
  4. Restart shell.

Does it work now?

@7ocb
Copy link
Author

7ocb commented Dec 3, 2021

@ivankravets yes, it looks like it working, thanks!

@7ocb
Copy link
Author

7ocb commented Dec 3, 2021

@ivankravets

image

Looks that for pio run it completes options that are not run's?

@ivankravets
Copy link
Member

These options are global per any pio command. Should it be a bug of the Click - Python library? We use it for CLI and for tab completion.

@jcw
Copy link

jcw commented Dec 4, 2021

On MacOS Monterey, using bash, I get:

RuntimeError: Shell completion is not supported for Bash versions older than 4.4.

@ivankravets
Copy link
Member

@jcw Latest macOS versions do not have bash shell and use zsh instead. Could you remove any pio tracks from ~/.zshrc and try pio system completion install zsh using the latest development version PlatformIO Core?

@jcw
Copy link

jcw commented Dec 4, 2021

I'm used to bash, so I've changed my login:

$ sh --version
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21)
Copyright (C) 2007 Free Software Foundation, Inc.

It's an old one, clearly (due to licensing issues). I have no ~/.zshrc.
Maybe I'll need to switch, but for now, I'll just pass on PIO completion.
Let me just note that shell completions for other commands work just fine.

PS. Yes, latest dev of PIO. No big deal, just wanted to flag this.

@ivankravets
Copy link
Member

@jcw This is not our limitation, we use Python's Click library. It seems they don't have support for older than 4.4 Bash version.

P.S: Highly recommend to check Fish shell, I've been using it for the last 5 years. Crazy cool.

@jcw
Copy link

jcw commented Dec 4, 2021

Crazy cool.

Ok, will do, Ivan :) - I've tried Fish long ago, but will revisit - the point is that I regularly log onto servers and RasPi's. Having bash on all of 'em simplifies my life a little.

@ivankravets
Copy link
Member

I regularly log onto servers and RasPi's

You can change the default shell at these devices as well (see chsh command ) :)

@jcw
Copy link

jcw commented Dec 4, 2021

Heh, I knew you'd say that. Sure, I could (and might), but a little bit of pushback is in order here, IMO: a tool such as PIO should be invariant w.r.t. shell choice (just as it is to editor choice, platform choice, etc). I understand that in this case it's beyond your control, and as I said: no big deal for me (I use short aliases for some key PIO cmds).

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

No branches or pull requests

3 participants