Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Order results by proximity #27

Open
flipsiderich opened this issue Dec 14, 2015 · 7 comments
Open

Order results by proximity #27

flipsiderich opened this issue Dec 14, 2015 · 7 comments

Comments

@flipsiderich
Copy link

Thanks for atom-inline-autocomplete. This may be more of a feature request than a bug.

In Komodo IDE, the 'suggestions' are based on proximity, so when you trigger the inline auto-complete, the options suggested to you are from matches going upwards through your file. This is very helpful as you can reliably know that you'll get the closest match again, e.g. when typing:

function myLongFunctionNameWhichIDontWantToRetype {
...
}

And then using auto-complete on the function name in the following:

var myVariable = myLongFunctionNameWhichIDontWantToRetype();

Currently with your Atom package, the order is harder to predict. I realise that this is from the auto-complete list which appears on screen, so may not be under your control.

Many thanks,
Richard.

Atom 1.2.4 on OS X 10.11.1

@oguma
Copy link

oguma commented Jan 13, 2016

I agree. In TextMate, 'suggestions' are based on proximity as well.

@alexchee
Copy link
Owner

I like this suggestion, but I don't have much time to work on it.

I have an idea of how to do this, if anyone want to tackle it.

  1. change matches to hold an object with the suggested word and position in buffer here https://github.com/alexchee/atom-inline-autocomplete/blob/master/lib/inline-autocomplete.coffee#L97
  2. Then sort them by distance from current word's position in buffer. Or even better store the matches in a sorted list based on word distance.

@brentgreeff
Copy link

@alexchee looks like a reasonable amount of code there, ( might look at it later ), this doesnt seem to be cycling through options at all anymore, just completing to some option in the document, and pressing "space" doesnt cancel the seconds insertion point. Hope someone has time to invest in this plugin.

@alexchee
Copy link
Owner

Got bored one night and trying it out here #28. Need to add more tests and figure out how much slower it is.

@flipsiderich
Copy link
Author

flipsiderich commented Mar 27, 2017 via email

@brentgreeff
Copy link

Just trying 1.1.0 - it does cycle through the options now - I think thats been fixed, but the cycling is not looped back. If u missed it the first time - then its gone.
it should allow u to cycle indefinitely.

It also cycles through options from the top of the document to the bottom. It should cycle the options closest to the cursor first.

Does anyone have any links to good tutorials on Atom plugins? Keen to give this a try.

@alexchee
Copy link
Owner

alexchee commented Apr 30, 2017

There should be a version 2.0.0 out now that has an setting checkbox, Suggest Closest, to cycle closest first, but I think I broke cycling backwards.

I've used the tutorial in the Atom Flight Manual: http://flight-manual.atom.io/hacking-atom/ to help make a package, but it the API docs might not be up to date. I remember seeing some references to SpacePen and Shadow DOMs which are getting removed.

I think it would be better to redo this plugin as a fork of https://github.com/atom/autocomplete-plus, to have all the goodies that package provide like custom providers for grammars.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants