Meteor-Community-Packages / Meteor-Community-Packages/meteor-autocomplete

Autocomplete filter only matches from the last token to the cursor position.

Open
#45 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
CoffeeScript
Stars
350
Forks
106
PR merge metrics
No merged PRs in 30d

Description

For example, in the demo if the text and cursor is

```
@aa|aa
```

The expected behavior would be to only show the `aaaa` record, but the current behavior is to show all strings starting with `aa`. This was copied from the original behavior in jquery-sew which looks for the string from the last token occurrence to the current cursor position, which is then passed to the rule regexes for processing.

Although the unexpected behavior from this rarely manifests in practice, a smarter way to do it would be to search up to the first word boundary **after** the cursor (or even a custom separator as proposed in [this commit](https://github.com/juan-lavaina/meteor-autocomplete/commit/a14243ea31330d1665102564f7211803d2a5dbc5)) and do the autocomplete as normal. However, I don't see a straightforward way to doing this via regexes without some unnecessarily complicated logic.

This issue was moved out of the README in [this commit](https://github.com/mizzao/meteor-autocomplete/commit/5fcf50b2391d825e30bdfd8a081af9bc54ab5680#diff-04c6e90faac2675aa89e2176d2eec7d8L180).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the demo case `@aa|aa` and trace the token extraction and rule-matching behavior copied from jquery-sew. Review the README history and the linked commits for the proposed boundary or separator handling. Done means the cursor-position case returns only the `aaaa` record without breaking normal autocomplete behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
coffeescript
Domain
frontend, search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.