Code Monkey home page Code Monkey logo

Comments (10)

m1ga avatar m1ga commented on August 19, 2024

should also consider position inside the string:
prio

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

version 0.18.0

from autocomplete-plus.

steelbrain avatar steelbrain commented on August 19, 2024

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.

from autocomplete-plus.

joefitzgerald avatar joefitzgerald commented on August 19, 2024

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.

from autocomplete-plus.

steelbrain avatar steelbrain commented on August 19, 2024

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

from autocomplete-plus.

joefitzgerald avatar joefitzgerald commented on August 19, 2024

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

from autocomplete-plus.

steelbrain avatar steelbrain commented on August 19, 2024

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

from autocomplete-plus.

joefitzgerald avatar joefitzgerald commented on August 19, 2024

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?

from autocomplete-plus.

steelbrain avatar steelbrain commented on August 19, 2024

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.

from autocomplete-plus.

joefitzgerald avatar joefitzgerald commented on August 19, 2024

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.

from autocomplete-plus.

pjv avatar pjv commented on August 19, 2024

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

from autocomplete-plus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.