I need a small guide of how build an autocomplete package


#1

Hi!!..I wish build an autocomplete plugin, I know how generate the suggestions and use the SelectListView but I’ve a few doubts about how select the current text under the cursos…basically and looking the autocomplete-plus package, seems than I only can get a character every time and need track every character and build the words checking the mouse position the tracking word and the letter under the coursor…that is good? or there is a more high level approach

basically…I think in this approach:

get the letter under the coursor and get the cursor position
when a new letter is typed, check the cursor position and try detect if the new letter is part of the same word (this is the tricky part)

if is a word, then compare it with other words and generate a suggestion (this is not a problem)

populate the SelectListView…

my biggest doubts are generated about how can I get the text, even I think than I can change an existing package, but I’m not totally sure about how get the text under the cursor…

any suggerence and help will be appreciate!!..thanks for reading


#2

Have you seen the tutorial on the autocomplete-plus repository?


#3

yes…but I had performances issues using it, because my autocomplete suggestion needs connect to an external services, similar issue has joefitzgerald implementing this for go language https://github.com/saschagehlich/autocomplete-plus/issues/36..just now he is doing a small fix, but I think than all these fixs add overhead and complicate the code where using a reactive lib like baconjs would be a good solution…

It’s more about personal interest of try implement this using baconjs, that is the reason why I wish implement this from zero…unfortunately I need check more the atom api (I did a small test with codemirror and works but atom api is different) and my big doubts are related in the word capture…

thanks