Sublime Forum

Strange Snippet expansion behavior

#1

Hello!
I bought Sublime Text a few days ago and am trying to get a few snippets for web typography to work. I am using Build 3211 under Linux and have only 4 packages installed: Package Control, Go Build, SyntaxFold and Show Unicode Name. None of these should interfere with snippet expansion.
The following two snippets behave weirdly:

<snippet>
<content><![CDATA[
‐
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>-</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>text.html.basic</scope>
</snippet>

and

<snippet>
<content><![CDATA[
…
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>...</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>text.html.basic</scope>
</snippet>

Note that in the first snippet, the trigger is a hyphen-minus (what you type), while the snippet content is a unicode “hyphen”, U+2010. In the second snippet, the content is a unicode ellipsis.

The problems:

  1. The first snippet is expanded when I type a “-” and hit tab. After that, no matter how often I hit tab, nothing happens. I would have expected the tab key to go back to inserting \t after expanding the snippet.
  2. The second snippet is often – not always – only triggered after hitting tab twice.

These things are not a big deal, but I am curious if I am missing something or if this is a ST bug.

0 Likes

#2

ST3 has a feature to replace the token in front of the caret with the next completion, which allows to cycle through all available suggestions via tab. For some reason pressing tab key always runs this command even though it should stop at some point.

You may try to disable that kind of completions by adding the following line to your user preferences.

  1. Open Command Palette
  2. Run “Preferences: Settings”
  3. Paste "tab_completion": false, into the right view.
  4. Save and close preferences.
0 Likes

#3

Thanks for the quick response! :slight_smile:

0 Likes