Comments (9)
Tested again. Now it's fixed!
from complgen.
Here's what works:
for path in ~/.config/complgen/*.usage; do
stem=$(basename "$path" .usage)
eval "
_complgen_jit_$stem () {
local words cword
_get_comp_words_by_ref -n = words cword
local prefix="\${words[\$cword]}"
local -a completions=(\$(complgen complete \"$HOME/.config/complgen/${stem}.usage\" bash --prefix="\$prefix" -- \${words[@]:1:\$cword-1}))
for item in "\${completions[@]}"; do
if [[ \$item = "\${prefix}"* ]]; then
COMPREPLY+=("\$item")
fi
done
__ltrim_colon_completions "\$prefix"
return 0
}
"
complete -o nospace -F _complgen_jit_$stem "$stem"
unset stem
done
from complgen.
Thanks for reporting!
from complgen.
Still broken: mygrep --color=n<TAB>
completes to mygrep --color=--color=never
.
I have built using cargo build
from latest commit and tested with bash --noprofile --norc -i; source /usr/share/bash-completion/bash_completion
.
from complgen.
Take another look please, it should work better now: https://github.com/adaszko/complgen/blob/4927e628c54244114a7d9d691a125333f9eeaafc/README.md#bash-integration
from complgen.
We are getting there. These autocomplete correctly now:
mygrep <TAB>
mygrep --color=<TAB>
mygrep --color=a<TAB>
mygrep --color=al<TAB>
but mygrep --color
completes to mygrep =
from complgen.
mygrep --color<TAB>
works on my end:
To be clear, I'm talking about the JIT mode, with Bash and complgen at commit 4927e62. Perhaps you're at some older commit?
from complgen.
I was using this grammar:
complgen/e2e/bash/test_bash_shell_integration.py
Lines 61 to 62 in 4927e62
Changing it to
mygrep --color=<WHEN>;
<WHEN> ::= always | never | auto;
fixes the bug.
from complgen.
Check again please. The issue was Bash weirdness to do with handling $COMP_WORDBREAKS
characters in completions (=
and :
are among which). Special filtering needs to be performed then to get correct results. I did that for shell script output in the past but seem to have forgotten about it for the JIT mode.
from complgen.
Related Issues (20)
- Friendlier parsing error messages
- `complgen scrape` should output grammars using the "distributive descriptions" feature
- [bash] Words containing a colon not completed correctly HOT 2
- zsh completion doesn't add space after choose a word HOT 4
- usage/complgen.usage is producing warnings HOT 2
- Completion for ZSH doesn't work in default path HOT 7
- Warning: Final DFA contains ambiguous transitions
- Bash: Respect `completion-ignore-case` readline setting
- JIT: Execute external command lazily based on the fallbacks order
- Implement fallback completions (`||`) in AOT mode
- Milestone: Rough feature parity with `git-completion.bash`
- There seems to be a discrepancy between the docs and the runtime HOT 4
- [FR] <PATH> behaviour inconsistent with non-complgen path completion HOT 4
- how to use external command to generate a list of available values with decriptions HOT 3
- Unable to use subword completion HOT 7
- Tag v0.2.0 doesn't update Cargo version HOT 1
- Release 0.2.0 introduces breaking changes when git is not present HOT 3
- Representing multiple exclusive words separated by , HOT 4
- Allow specifying regex that external command output must match
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from complgen.