Skip to content
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

Some flexibility around completions #5

Closed
dloverin opened this issue Mar 15, 2013 · 5 comments
Closed

Some flexibility around completions #5

dloverin opened this issue Mar 15, 2013 · 5 comments

Comments

@dloverin
Copy link
Contributor

The rules for Tern completions are fine for many cases but I would like the flexibility to implement a different set of completion rules:

  • case insensitive matches
  • matching in the middle of hints, not just prefixes
  • not always sorting the list alphabetically
  • different rules as to when guesses should and should not be included in completions
  • sorting identifiers based on scope distance from cursor

One way to implement this would be just to return all of the completions along with the found prefix and let the editor match and sort. There, of course, may a better way.

One addition piece of information on identifiers that would be useful is the relative level of the scope where the identifier was found. Say, zero, would be the scope at the cursor, and one would be the next outer scope and so on.

What are your thoughts on how to best provide this flexibility?

Thanks,

-Darrell Loverin

@hoschi
Copy link

hoschi commented Mar 16, 2013

+1! Maatch in the middle like YouCompleteMe, CommandT or CtrlP (vim plugins) are very usefull :)

@marijnh
Copy link
Member

marijnh commented Mar 16, 2013

This is definitely on the radar. Probably eventually there'll be a 'simple' completion service like the one that currently exists, and a 'full' one where you get every possible completion and then some, and the plug-in has to do a bit more work to actually filter them itself.

I have not gotten around to this yet.

@marijnh
Copy link
Member

marijnh commented Mar 26, 2013

The completions service now allows some control over the returned data by adding properties to the query:

  • types: Add a field indicating the type of the completed thing
  • depths: Add a field indicating the distance (in scope or prototype chain) to the completed thing
  • omitObjectPrototype: Explicitly set to false to disable the default heuristic where it assumes you only want to see hasOwnProperty and friends if you have at least two matching letters.
  • filter: Explicitly set to false to get all possible completions, not just matching ones.
  • guess: Set to false to disable behavior where, if nothing is found, it adds any matching properties it can find.
  • sort: Set to false to get the results unsorted.

@marijnh marijnh closed this as completed Mar 26, 2013
@andykais
Copy link

andykais commented May 4, 2016

Is this something I can add to a .tern-project file? I would like a way to hide builtins from my autocompletion like prototype

@marijnh
Copy link
Member

marijnh commented May 5, 2016

You'd have to implement it in your editor plugin, or as a tern plugin providing a custom completion query type.

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

No branches or pull requests

4 participants