ajaxorg / ace

Ace (Ajax.org Cloud9 Editor)
https://ace.c9.io
Other
26.69k stars 5.28k forks source link

Multiple snippets with same trigger #2531

Closed geraintwhite closed 9 years ago

geraintwhite commented 9 years ago

If I have two snippets in my mode's .snippets file like so:

snippet >
description assignment
scope maze
    -> ${1}= ${2}

snippet >
description if
scope maze
    -> IF ${2:**} THEN %${3:L} ELSE %${4:R}

Pressing tab after typing > auto-completes to the second snippet which is understandable. The problem is that the auto-complete list (ctrl-space) only shows the second snippet.

nightwing commented 9 years ago

Why do you want to create two snippets with same tabtrigger?

geraintwhite commented 9 years ago

Not the same tab trigger, but so they both show up in the autcomplete list.

nightwing commented 9 years ago

But then why to you set same tabTrigger on both of them?

Try using name instead

name assignment
scope maze
    -> ${1}= ${2}
name if
scope maze
    -> IF ${2:**} THEN %${3:L} ELSE %${4:R}

https://github.com/ajaxorg/ace/blob/master/lib/ace/ext/language_tools.js#L60

geraintwhite commented 9 years ago

Will they both show up in autocomplete for > then?

geraintwhite commented 9 years ago

Not showing up in the auto-complete menu is to do with #2533. Closing because it is not logical to have the same tabTrigger and setting the name parameter should get them to both show up.