Skip to content

autocomplete does not work well with multi-word data #1014

Open
@ZachHaber

Description

@ZachHaber

Multi-word autocomplete entries don't work well. If you have fairly unique entries, it'll mostly work. You still have to be aware that you need to add " around the options you return from the autocomplete function, otherwise it won't autocomplete with quotes - which makes them separate arguments.

If you have options that differ only after the first word, then the whole thing just fails as-is - even with quotes.

For example, use this as the autocomplete, and attempt to autocomplete "nonunique second word":

export function autocomplete() {
  return ['"unique first"', '"nonunique second word"', '"nonunique sea word"'];
}

You'll get to "nonunique se and it will no-longer register any autocomplete options!

If you then add 'seriously' to the list of options (['"unique first"', '"nonunique second word"', '"nonunique sea word"', 'seriously']), then it would autocomplete to "nonunique seriously from "nonunique se

The only way around this is to do a ton of parsing in the autocomplete function to try and figure out what already exists, and then only return the next parts of matching options, and as was mentioned in #522, it's rather complex to try and figure out what is already set and what isn't.

Version: v2.5.2 (c6141f2)

I've already written myself a wrapper to deal with this issue (and a few more), but I just wanted to bring it to light, since I couldn't find a bug that dealt with this particular part of the autocomplete.

For reference: this came up as I was trying to add autocomplete for contract types.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions