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

perf(bash-v2): speed up filtering entries with descriptions #1689

Merged
merged 1 commit into from
May 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
perf(bash-v2): speed up filtering entries with descriptions
Use simple prefix match instead of single word `compgen -W` command
substitution for each candidate match.
  • Loading branch information
scop committed May 3, 2022
commit ce36da4fef09ba68240762daa33d560ecf848d56
3 changes: 1 addition & 2 deletions bash_completionsV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ __%[1]s_handle_standard_completion_case() {
# Strip any description before checking the length
comp=${compline%%%%$tab*}
# Only consider the completions that match
comp=$(compgen -W "$comp" -- "$cur")
[[ -z $comp ]] && continue
[[ $comp == "$cur"* ]] || continue
COMPREPLY+=("$compline")
if ((${#comp}>longest)); then
longest=${#comp}
Expand Down