atom-typescript icon indicating copy to clipboard operation
atom-typescript copied to clipboard

Sort order of autocomplete snippet items

Open nycdotnet opened this issue 11 years ago • 13 comments

Do we have any control over autocomplete sorting? If so, I think that properties should be prioritized over autocompletes after a dot.

For example, in this screenshot I typed .fi. When I hit tab, I would expect .files to autocomplete, but as you can see in the screenshot, the fix template is the default when I hit tab.

sortorderinautocomplete

Possibly related to #141.

nycdotnet avatar Sep 10 '15 16:09 nycdotnet

Do we have any control over autocomplete sorting

Yes. Code is here : https://github.com/TypeStrong/atom-typescript/blob/e0e603e1e32c9baaa63bcdebfc07872bc267b1d2/lib/main/atom/autoCompleteProvider.ts#L228-L239 We put all snippets before code completions ... in hindsight probably a bad choice :) ...

Decent fix : just change unshift to push :rose:

basarat avatar Sep 11 '15 06:09 basarat

:+1:

tomitrescak avatar Sep 15 '15 05:09 tomitrescak

Hi I tried to change it where you proposed but no chnage. I guess I'll just wait for your official patch ;) Thanks.

tomitrescak avatar Sep 21 '15 07:09 tomitrescak

Any idea when this is going to hit the release? At least 20 times per day I wish it was already there ;)

tomitrescak avatar Oct 02 '15 00:10 tomitrescak

Any idea when this is going to hit the release? At least 20 times per day I wish it was already there ;)

@tomitrescak Thanks for your patience (especially with #611 which is also fixed now). So your reward is that this is fixed with https://github.com/TypeStrong/atom-typescript/releases/tag/v7.1.1 :rose:

basarat avatar Oct 04 '15 05:10 basarat

@basarat you're my hero;) thanks for the effort. This plugin really shines and makes development of typescript as easy as it can get! Thanks!

tomitrescak avatar Oct 04 '15 13:10 tomitrescak

The ordering should consider exact match of the snippet. for example, I've type the exact keyword ifel, expect to see it on top of other less related suggestions

screen shot 2016-08-31 at 12 08 10 pm

roycwc avatar Aug 31 '16 04:08 roycwc

Hi, in the current version the code has changed and the provided solution does not work.

Is there a way currently to change the order of the autocomplete? I want my custom snippets to appear first, not the provided by the package.

Thanks in advanced.

romelperez avatar Sep 12 '17 21:09 romelperez

@romelperez +1. partially related to #1185 it seems, but the "fix" mentioned in this issue put snippets at the bottom of the suggestions. However, in your case, as is mine, it seems what it really needs is to defer to autocomplete-plus's "Alternative Scoring" and prefer runs of characters over other matches, in your example the ifel snippet should be ranked first because it's an exact match.

jdhines avatar Sep 15 '17 16:09 jdhines

What I did was to set a prefix in the snippets names so at least there is a filter so some suggestions are not shown up, because I didn't find a proper way to change the sorting.

romelperez avatar Sep 15 '17 23:09 romelperez

What I did was to set a prefix in the snippets names

What do you mean by this? All snippets have a prefix. My only "fix" so far has been that I found out ctrl+n, ctrl+p let me move through the list without moving my hands to the arrow keys, but still, I want it to rank exact matches higher than fuzzy matches.

jdhines avatar Sep 19 '17 12:09 jdhines

For example, I have an snippet named "component" and I renamed as "jcomponent" and when I type "jcom" that snippet appears in the first place. Something silly but works.

romelperez avatar Sep 19 '17 13:09 romelperez

that's kinda what I did too, using jit for "jasmine it test," but despite that being the only exact match, it still lists a fuzzy-matched thing first.

jdhines avatar Sep 21 '17 13:09 jdhines