Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Add priority stuff to suggestions #29

Closed

Description

@saschagehlich

As propsed by @pjv, we should add some priority stuff to the suggestions:

  • matches from the current language syntax file
  • matches from snippets for the current language
  • matches from word list from the current file buffer

Activity

  1. m1ga commented on May 9, 2014

    @m1ga

    should also consider position inside the string:
    prio

    move_uploaded_file should be 1st suggestion (why is appearing twice?)

    version 0.18.0

  2. modified the milestone: 2.0 on Dec 31, 2014
  3. steelbrain commented on Jan 27, 2015

    @steelbrain
    Contributor

    I was using string_score to score the current term and sort suggestions according to that. would love to have autocomplete-plus do it itself.

  4. joefitzgerald commented on Jan 27, 2015

    @joefitzgerald
    Contributor

    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.

  5. steelbrain commented on Jan 28, 2015

    @steelbrain
    Contributor

    @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?

  6. joefitzgerald commented on Jan 28, 2015

    @joefitzgerald
    Contributor

    @steelbrain Currently, autocomplete-plus suggestion order is dictated by:

    1. 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 *)
    2. 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?

  7. steelbrain commented on Jan 28, 2015

    @steelbrain
    Contributor

    @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.

  8. joefitzgerald commented on Jan 28, 2015

    @joefitzgerald
    Contributor

    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?

  9. steelbrain commented on Jan 28, 2015

    @steelbrain
    Contributor

    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.

  10. joefitzgerald commented on Jan 28, 2015

    @joefitzgerald
    Contributor

    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.

  11. pjv commented on Jan 30, 2015

    @pjv

    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).

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions