Skip to content

Hoist exact matches to top of autocomplete suggestions#486

Closed
user24 wants to merge 1 commit into
devbridge:masterfrom
user24:master
Closed

Hoist exact matches to top of autocomplete suggestions#486
user24 wants to merge 1 commit into
devbridge:masterfrom
user24:master

Conversation

@user24
Copy link
Copy Markdown

@user24 user24 commented May 30, 2016

For query "Bee", with data:

var suggestions = [{
    "value": "beetle"
},{
    "value": "beezlebub"
},{
    "value": "bee"
},{
    "value": "beet"
}]

Used to suggest:

beetle
beezlebub
bee
beet

now suggests:

bee
beetle
beezlebub
beet

Could be improved further but it's better than no sorting.

@user24
Copy link
Copy Markdown
Author

user24 commented May 30, 2016

Would actually be better to allow people to supply their own sort function, with something like this as the default, imho.

@tkirda
Copy link
Copy Markdown
Member

tkirda commented Jun 2, 2016

You can actually provide your own lookup function where you can filter and sort results anyway you want.

Also it would make sense that sort function can be provided via options and optional.

@tkirda
Copy link
Copy Markdown
Member

tkirda commented May 20, 2026

Thanks for this contribution, and apologies for the very long silence.

The project was dormant for several years and has just shipped v2.0, which is a ground-up TypeScript rewrite with a new build (esbuild), test runner (Vitest + jsdom), and CI pipeline. As a result this PR no longer applies cleanly against master, and the surrounding code it touches has changed enough that mechanically rebasing it wouldn't be safe.

I'm closing it as part of a triage pass on the long-stale PR backlog — not because the idea lacks merit. If this change is still valuable to you against 2.0, please open a fresh PR (or an issue first if you'd like to confirm direction); I'll review new submissions against the current codebase promptly.

Thanks again for taking the time.

@tkirda tkirda closed this May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants