gregziegan / elm-autocomplete

Autocomplete for Elm apps; in Elm
http://package.elm-lang.org/packages/thebritican/elm-autocomplete/latest
BSD 3-Clause "New" or "Revised" License
173 stars 43 forks source link

What is the point of providing the number of results to show? #55

Open simonh1000 opened 7 years ago

simonh1000 commented 7 years ago

The question came to me when considering a css styles autocomplete. Type in color and - for 5 results - you get a bunch of results border-...-color. I'd like that for onDownArrow you start circling through the rest of the acceptable results.

As things stand I would need to handle that in acceptableStyles and add to my model an offset to drop from the beginning of the results. But at that stage I might as well drop all results beyond the 5th as well.

At it feels as though that is true more generally. After identifying the list of acceptable candidates I could drop the excess. I presume that's what you do with the integer that I pass anyway. As a result, it seems to me that you get the exact same functionality by asking the user to chop the number of acceptables, count the length of what is passed if you need to, and reduce one parameter from the API.

An alternative would be that the library handles the showing of surplus acceptables in the way I describe above, but I think you are delegating decisions on down arrows from the bottom item of the list back to the developer, which is reasonable.