-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async suggest #45
base: master
Are you sure you want to change the base?
Async suggest #45
Conversation
This PR makes suggest operating asynchroniously, providing _much_ faster performance, much smaller memory use, and allowing to stop a suggestion search midway. suggest : function (word, limit, doneFunc, progressFunc) - returns undefined - doneFunc (if given) will be called (with the results array) once the search is done - progressFunc (if given) will be called (with the new match and the array of all matches so far) whenever a new match is found in the search - if progressFunc returns===false the current search will be aborted - calling suggest without parameters will abort a current search if running See a working sample in https://plnkr.co/edit/0y1wCHXx3k3mZaHFOpHT
To be honest, at this point, there are so many commits and no clear documentation of each commit that I would feel very uneasy merging in these changes. |
yeah complicated but work very well ... (and documented) I wrote this for CodeMirror, without async there is an unacceptable wait between pressing the right click and getting the results. see the gist here: https://gist.github.com/kofifus/4b2f79cadc871a29439d919692099406 anyways .. |
Personally, I don't inspect every commit when review a PR. I check "Files changed" tab only. |
This PR adds the option of running suggest asynchronously allowing updating the display with results as they come, and stopping a suggestion search midway. Also provides much faster performance and smaller memory use on both synchronous and asynchronous suggests.
The suggest function can now be called in one of three ways:
suggest(word, limit [=5])
suggest(word, limit [=5], doneFunc, progressFunc) where either doneFunc or progressFunc are defined
suggest()
Other changes:
See a working sample in plunkr