You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
autocomplete+ v2 will order suggestions by provider, in the order of provider scope registration (the most specific provider wins). You should ensure your provider is then ordering it's suggestions appropriately (perhaps using the technique you suggested.
In practice, the prefix is usually fairly static / the same for all providers so I'm not sure sorting by prefix would provide much value being in the core. See #186 and the new wiki page for the Provider API.
@steelbrain Currently, autocomplete-plus suggestion order is dictated by:
Provider order, where the most specific provider (by selector) wins (i.e. a provider registered for .scope.js .function will win over a provider registered for .scope.js or *)
The order the suggestions are in when returned by the provider (i.e. all subsequent array operations are stable and do not re-order them)
Because the default for maxItems is 10, typically, there are not ordering challenges with this new technique. Previously, there was no way to guarantee order for providers by specificity of scope, so we're doing much better.
I'm not an advocate for trying to specify order of suggestions across providers, so I think what you're asking for is a helper function to sort by score. But that feels like something _.sortBy can handle, and is not a big deal. Can you help sell me on why this needs to be in the core? Or correct my understanding?
@joefitzgerald AutoComplete providers often parse the code line by line and generate autocomplete suggestions [1] or they use other programs to do it for them [2].
The other programs that providers use often do the sorting themselves, but sometimes they suck it,
for example $mai would have the $main result at the top but $main->res will have $main->asort at the top.
In both the cases developers have to use modules like fuzzaldrin to sort the results. and I think it would be a lot more efficient if one package autocomplete-plus does it instead of all those provider packages.
So you would propose a score property on match and that autocomplete-plus would do an ascending sort on that field (if present)? Or something more complex?
a simple score field would work great as well. But to generate that score, people will still have to use a node module in each provider, it would be awesome to have autocomplete-plus score the words itself, based on the prefix.
I'm not sure we could ever have a single generic scoring algorithm, but would gladly accept a PR that does it. There have been various grumblings similar to this on discuss.atom.io. Even if this was available it would have to be optional as providers like gocode in go-plus know way more about the code than a generic scoring algorithm.
fwiw at this point, the original request that i made that got turned into this issue was nothing to do with scoring matches (i.e. the order of completions within a provider), but was instead for a UI to allow the user to prioritize the order of the PROVIDERS themselves. e.g. to be able to register a preference for snippets to come before buffer completions (or vice versa). and as a further refinement, to be able to register different sets of provider rankings on a grammar by grammar basis (maybe through separate config files for individual grammars).
Activity
m1ga commentedon May 9, 2014
should also consider position inside the string:

move_uploaded_file should be 1st suggestion (why is appearing twice?)
version 0.18.0
steelbrain commentedon Jan 27, 2015
I was using
string_scoreto score the current term and sort suggestions according to that. would love to have autocomplete-plus do it itself.joefitzgerald commentedon Jan 27, 2015
autocomplete+ v2 will order suggestions by provider, in the order of provider scope registration (the most specific provider wins). You should ensure your provider is then ordering it's suggestions appropriately (perhaps using the technique you suggested.
In practice, the prefix is usually fairly static / the same for all providers so I'm not sure sorting by prefix would provide much value being in the core. See #186 and the new wiki page for the Provider API.
steelbrain commentedon Jan 28, 2015
@joefitzgerald steelbrain/Atom-Hack@cdd484c#diff-752acd996cb6fc31f4ed093cdfecd4c5R36 currently the autocomplete providers have to do this themselves, wouldn't it be nice if autocomplete-plus would do it?
joefitzgerald commentedon Jan 28, 2015
@steelbrain Currently,
autocomplete-plussuggestion order is dictated by:.scope.js .functionwill win over a provider registered for.scope.jsor*)Because the default for
maxItemsis 10, typically, there are not ordering challenges with this new technique. Previously, there was no way to guarantee order for providers by specificity of scope, so we're doing much better.I'm not an advocate for trying to specify order of suggestions across providers, so I think what you're asking for is a helper function to sort by score. But that feels like something
_.sortBycan handle, and is not a big deal. Can you help sell me on why this needs to be in the core? Or correct my understanding?steelbrain commentedon Jan 28, 2015
@joefitzgerald AutoComplete providers often parse the code line by line and generate autocomplete suggestions [1] or they use other programs to do it for them [2].
The other programs that providers use often do the sorting themselves, but sometimes they suck it,
for example
$maiwould have the$mainresult at the top but$main->reswill have$main->asortat the top.In both the cases developers have to use modules like
fuzzaldrinto sort the results. and I think it would be a lot more efficient if one packageautocomplete-plusdoes it instead of all those provider packages.joefitzgerald commentedon Jan 28, 2015
So you would propose a
scoreproperty onmatchand thatautocomplete-pluswould do an ascending sort on that field (if present)? Or something more complex?steelbrain commentedon Jan 28, 2015
a simple score field would work great as well. But to generate that score, people will still have to use a node module in each provider, it would be awesome to have autocomplete-plus score the words itself, based on the prefix.
joefitzgerald commentedon Jan 28, 2015
I'm not sure we could ever have a single generic scoring algorithm, but would gladly accept a PR that does it. There have been various grumblings similar to this on discuss.atom.io. Even if this was available it would have to be optional as providers like
gocodeingo-plusknow way more about the code than a generic scoring algorithm.pjv commentedon Jan 30, 2015
fwiw at this point, the original request that i made that got turned into this issue was nothing to do with scoring matches (i.e. the order of completions within a provider), but was instead for a UI to allow the user to prioritize the order of the PROVIDERS themselves. e.g. to be able to register a preference for snippets to come before buffer completions (or vice versa). and as a further refinement, to be able to register different sets of provider rankings on a grammar by grammar basis (maybe through separate config files for individual grammars).