Sublime Forum

Sublime-snippet tabtrigger is behaving differently than sublime-completions trigger

#1

When I create a trigger with periods in a *.sublime-completions file, those completions show up in the auto-complete list even if I only type part of the trigger.

For example, this completion:

{ "trigger": "Ext.Array.each", "contents": "this is a test" }

Will show up even if I only type “Array” or “each”.
Imgur

But when I do the same thing in a snippet, using the following:

<tabTrigger>Ext.Array.each</tabTrigger>

It shows when I type “Ext”. If I then type a period, it’s gone from the autocomplete list, and it never shows up if I type “Array” or “each”.

Question:
How can I get the behavior of the *.sublime-completions file but still be able to use snippets so I can write multi-line completions without a headache?

0 Likes

#2

I guess it is due to the way autocomplete handles snippets with tab triggers that contain word separator characters…

0 Likes

#3

See also:


Maybe John and/or Will will fix this. There’ve been a few related issues for a long time.

0 Likes

#4

Thanks for the replies. I suppose I’m going to have to wait on more ST3 releases. I might end up building a “snippet to completion” script so I can maintain long snippets easily while still have them always show up in the auto-complete list, or look into plugins that enhance auto-completion.

0 Likes

#5

I had a quick go at writing a generic plugin here to always show completions for snippet tab triggers:

0 Likes

#6

Ah, I actually saw that post while I was researching auto-complete! Though, I don’t know Python and didn’t take the time to try to understand the block of code at the time. It looks like a good starting point, though. Thanks!

0 Likes