-
Notifications
You must be signed in to change notification settings - Fork 164
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
Autocomplete fails while using zsh. #534
Comments
The fact that you have Please share the version numbers of
|
@dirk-thomas You're right. I've install My result for the two commands: $ pip3 freeze | grep arcomplete
# Nothing output
$ dpkg -l | grep argcomplete
ii python3-argcomplete 1.8.1-1ubuntu1 all bash tab completion for argparse (for Python 3)
ii python3-colcon-argcomplete 0.3.3-1 all Completion for colcon command lines using argcomplete. I guess you want to see the version of
|
I can reproduce the problem with Eloquent (using I think this is a duplicate of kislyuk/argcomplete#258. Either you use a newer version of
|
@j-rivero to work on getting a patch upstream. |
@dirk-thomas Thank you for the suggestion. The patch works perfectly!!! |
We will keep it open until it is tracked upstream. |
Hi! I have just installed ROS 2 (Galactic) for the first time on my machine (Ubuntu 20.04). I am also a user of ZSH, and for some reason the autocomplete isn't working; but it works on the Bash. Some more info: ➜ ~ zsh --version
zsh 5.8 (x86_64-ubuntu-linux-gnu)
➜ ~ which _bash_complete
_bash_complete () {
local ret=1
local -a suf matches
local -x COMP_POINT COMP_CWORD
local -a COMP_WORDS COMPREPLY BASH_VERSINFO
local -x COMP_LINE="$words"
local -A savejobstates savejobtexts
(( COMP_POINT = 1 + ${#${(j. .)words[1,CURRENT-1]}} + $#QIPREFIX + $#IPREFIX + $#PREFIX ))
(( COMP_CWORD = CURRENT - 1))
COMP_WORDS=($words)
BASH_VERSINFO=(2 05b 0 1 release)
savejobstates=(${(kv)jobstates})
savejobtexts=(${(kv)jobtexts})
[[ ${argv[${argv[(I)nospace]:-0}-1]} = -o ]] && suf=(-S '')
matches=(${(f)"$(compgen $@ -- ${words[CURRENT]})"})
if [[ -n $matches ]]
then
if [[ ${argv[${argv[(I)filenames]:-0}-1]} = -o ]]
then
compset -P '*/' && matches=(${matches##*/})
compset -S '/*' && matches=(${matches%%/*})
compadd -Q -f "${suf[@]}" -a matches && ret=0
else
compadd -Q "${suf[@]}" -a matches && ret=0
fi
fi
if (( ret ))
then
if [[ ${argv[${argv[(I)default]:-0}-1]} = -o ]]
then
_default "${suf[@]}" && ret=0
elif [[ ${argv[${argv[(I)dirnames]:-0}-1]} = -o ]]
then
_directories "${suf[@]}" && ret=0
fi
fi
return ret
} |
@ferrolho I've tried the same patch in Galactic, and autocomplete doesn't work. |
Hi, I'm having the same problem as @ferrolho with I will add that |
I meet the problem also both Foxy and Galactic. The patch didn’t work either. also zsh is 5.8, |
Having the same issue with ZSH and ROS2 Galactic. Previously used ROS Noetic and tab auto-complete worked perfectly |
Having the same issue with Zsh and ROS2 Galactic too. But I found a solution in https://kislyuk.github.io/argcomplete/#zsh-support By adding these lines to # argcomplete for ros2 & colcon
eval "$(register-python-argcomplete3 ros2)"
eval "$(register-python-argcomplete3 colcon)" (Thanks to #534 (comment), I removed the unnessecary |
I have also been struggling with this argcomplete issue with ZSH and ROS2 Galactic for a long while. Thanks for the constructive suggestions in sink0918's comment. Actually I found that it's working by adding simply this in .zshrc: The arg completion for colcon was previously solved by sourcing colcon-argcomplete in .zshrc as described in colcon-Enable completion: |
That worked for me, thanks for sharing! |
Huh, interesting. So it turns out that we are already calling Actually, I found out that after sourcing
That suggests to me that something else later in the sourcing process is unregistering what was already registered. Someone would need to look deeper into it to find out exactly why this isn't working as expected. |
Thank you a lot, I solve my problem by your sharing |
Instead of running
Then I'm not sure what a final fix should be, especially since tab completion for |
Hi, |
Someone needs to debug it further, since we don't really understand the underlying cause. If you happen to find the problem and open a pull request, we're happy to review it. |
Aah got it. I don't have any previous experience with working on such an autocompletion tool. Are there any good resources to learn about this tool or any other autocompletion tool? I'd love to fix this issue. It's bugging me for a few days now TIA Edit: Found a setup tool doc in the README. Will start from there |
@hardesh I think I was on to something with |
@frankkusters I observed the same.
|
For testing I removed the line
In order to make it work properly I have to add above line in my .zshrc before sourcing ROS workspace (and colcon-argcomplete). Whithout it it does not work. So it seems to be mandatory. |
Should |
Maybe rather than removing the if (( ! ${+_comps} )); then
autoload -U +X compinit && compinit
fi This way neither completion script ordering nor the possible Edit: NVM had similar problem, but I'm not sure whether their solution works as intended - it calls |
I am using Ubuntu 20.04 and Foxy, I have ZSH and oh-my-zsh installed.
|
Fixed by #750 |
Saved me! Thank you!! |
I am having an issue with this. I do have when using:
I am getting an error
Any suggestion? |
This works for jazzy / ubuntu 24.04 with zsh argcomplete for ros2 & colcon in zsheval "$(register-python-argcomplete ros2)" |
Bug report
Required Info:
Steps to reproduce issue
I use zsh as my shell, but I find some problems while using
<tab>
to autocomplete.ros2 run <tab>
, it works well.ros2 run d<tab>
, it can't show the packages which starts with 'd'.Additional information
After some debugging, I find that the behavior is related to argcomplete library in Python 3.
If I remove the library
rm -rf ~/.local/lib/python3.6/site-packages/argcomplete*
, zsh works well again.I'm not pretty sure what the root cause is.
Maybe argcomplete library does not support zsh well.
The text was updated successfully, but these errors were encountered: