How do I go about troubleshooting autocompletion not working in Zsh?
I have a setup/cleanup script that successfully adds and removes:
# begin app completion
. <(app --completion)
# end app completion
I have also setup this alias in ~/.zshrc: alias lando='bin/app.js'.
app --completion outputs:
### app completion - begin. generated by omelette.js ###
if type compdef &>/dev/null; then
_app_completion() {
compadd -- `app --compzsh --compgen "${CURRENT}" "${words[CURRENT-1]}" "${BUFFER}"`
}
compdef _app_completion app
elif type complete &>/dev/null; then
_app_completion() {
local cur prev nb_colon
_get_comp_words_by_ref -n : cur prev
nb_colon=$(grep -o ":" <<< "$COMP_LINE" | wc -l)
COMPREPLY=( $(compgen -W '$(app --compbash --compgen "$((COMP_CWORD - (nb_colon * 2)))" "$prev" "${COMP_LINE}")' -- "$cur") )
__ltrim_colon_completions "$cur"
}
complete -F _app_completion app
fi
### app completion - end ###
My app.js contains:
// Write your CLI template.
var completion = omelette('app <test> <test2>')
// This is your logic
completion.on('test', ({reply}) => { reply(['option1', 'option2']) });
completion.on('test2', ({reply}) => { reply(['option3', 'option4']) });
completion.init();
Now, I expect when that when I type app<tab> that I will see the options, but I do not. What are my next steps to troubleshooting? What command outputs the options that I hope to see? Is it possible that my JS is outputting garbage prematurely that breaks Zsh's autocompletion?
Same here +1
+1 I'm also facing the same issue and i am not sure how to proceed.
+1 I'm also facing the same issue and i am not sure how to proceed.
Debugged my code and found that the issue was with my code actually.
While running . <(app --completion) it ran through my code and stopped at a point where i have set
process.stdin.setRawMode( true )
process.stdin.resume()
After removing this line the completion began to work properly. I am not sure why but thought this may help someone.
Were you able to get this to work? Its not working for me either. Thinking if it could be related to oh-my-zsh installed.
I have not revisited this.
Running into this too