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

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.