Customizing Autocomplete Suggestions like IntelliSense

21 views
Skip to first unread message

Joshua Koo

unread,
Jun 16, 2015, 9:53:16 PM6/16/15
to tern...@googlegroups.com
Hello again!

Sorry for spamming the group, but I'm actually quite interested to know how I could customize the filtering of suggestions returned by Tern. Right now we could customize the filtering to check for case sensitiveness, but I'm thinking of possibly adding a filtering which uses some string distance (eg. Jaro–Winkler string distance or Levenshtein distances). That allows auto-complete to be smarter (like IntelliSense I believe), that matches possible competitions even if you are making a typo.

If someone knows where I could start poking into, I'll test to see if this would be preferable behaviour in editors.

Cheers,
Joshua


Marijn Haverbeke

unread,
Jun 17, 2015, 3:46:39 AM6/17/15
to Joshua Koo, tern-dev
A client could add a `filter: false` property to the query that asks
for completions, which will return all possible completions. You could
then do custom filtering on the client side.
> --
> You received this message because you are subscribed to the Google Groups
> "tern-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to tern-dev+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Joshua Koo

unread,
Jun 22, 2015, 11:26:59 AM6/22/15
to Marijn Haverbeke, tern-dev
Passing `filter: false` with codemirror tern server plugin indeed return all the suggestions

new CodeMirror.TernServer({
queryOptions: {
completions: {
filter: false
}
}
});

Even though I have to edit the plugin, it opens out a lot more possibilities (http://stackoverflow.com/questions/2901831/algorithm-for-autocomplete)

Thanks for the advice!
Reply all
Reply to author
Forward
0 new messages