f / f/omelette
How do I go about troubleshooting autocompletion not working in Zsh?
- Dominant language
- CoffeeScript
- Stars
- 1.4k
- Forks
- 40
- PR merge metrics
- No merged PRs in 30d
Description
I have a setup/cleanup script that successfully adds and removes:
```bash
# begin app completion
. <(app --completion)
# end app completion
```
I have also setup this alias in `~/.zshrc`: `alias lando='bin/app.js'`.
`app --completion` outputs:
```bash
### 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 ')
// 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` 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?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.