Sublime Forum

How to make it so completion also searches the <description> text?

#1

So, a snippet is composed of the following info:

<snippet>
    <content><![CDATA[Type your snippet here]]></content>
    <!-- Optional: Tab trigger to activate the snippet -->
    <tabTrigger>for</tabTrigger>
    <!-- Optional: Scope the tab trigger will be active in -->
    <scope>source.python</scope>
    <!-- Optional: Description to show in the menu -->
    <description>for loop</description>
</snippet>

If I have a snippet for “for” in which the tab-trigger is “for”, and the description is “for loop”, I want auto-complete to also find the snippet if I type “loop”. Is this possible?

0 Likes

#2

The description is only used for displaying additional information about what the snippet does in the command palette. A snippet can have only a unique trigger. If you want the same snippet to trigger for both for & loop, then I believe you’d require 2 seperate snippets with different tab triggers and same tab content.

More information: https://www.sublimetext.com/docs/completions.html#snippets

0 Likes