2

I have the following snippet:

<snippet>
    <content><![CDATA[
{{#_}}${1:$SELECTION}{{/_}}
]]></content>
    <tabTrigger>i18n</tabTrigger>
    <!-- What can I put in scope? -->
    <scope>text.handlebars</scope>
</snippet>

But I only want it to be available within files that end in ".handlebars". I want to do this because I want to overload the i18n tab trigger for several different filetypes. Right now, I am stuck with renaming the tab trigger for this particular case.

This question is very useful for existing scopes: Defining scope for custom Sublime Text 2 snippets

Community
  • 1
  • 1
Matt Faus
  • 6,321
  • 2
  • 27
  • 43

1 Answers1

2

For your handlebars example, nrw / sublime-text-handlebars uses text.html.handlebars. You'll need the Handlebars.tmLanguage file to have the syntax.

Edit: The scope name is defined by the scopeName key in the syntax's tmLanguage file. Again for your example, line 681 of Handlebars.tmLanguage:

<key>scopeName</key>
<string>text.html.handlebars</string>

To create your own syntax definition, see this unofficial documentation article. scopeName sets the value that should be used for the scope key in the snippet definition.

d_rail
  • 4,109
  • 32
  • 37