Sublime Forum

ST4 and snippets broken?

#1

After the upgrade to ST4, I can no longer use snippets by typing the snippet string and hitting tab.

I first thought this might be happening for the snippets I defined but even the built-in proto snippet for JavaScript is behaving the same way. The autocomplete suggestions do not offer a snippet choice. See below.

05%20AM

However, clicking the snippet from Tools -> Snippets works. Anyone else seeing this problem?

Regards,
Bijoy

1 Like

ST4 issues I found, but have no time to write proper bug reports (yet)
#2

The proto snippet works fine here for me; can you replicate this problem in Safe Mode?

0 Likes

#3

Looks like it works as expected in safe mode.

Any suggestions on how to go about identifying and fixing the issue in regular mode?

1 Like

#4

It looks like there are some snippet choices … but those aren’t the ones that have been defined. The snapshot below shows “props” as a snippet? I don’t have something like that defined as a snippet.

00%20AM

I do however have “props” as a custom autocompletion that’s been defined in a sublime-completions file. Removing the sublime-completions file results in “props” no longer appearing as a snippet choice but I still don’t see the expected snippet appearing in that menu.

0 Likes

#5

Generally speaking, if it works in Safe Mode then some package or customization in your User package is getting in the way. For things like AutoComplete this can take the form of having packages installed that are trying to provide some sort of code intelligence of some sort.

To narrow it down you can try disabling all third party packages and seeing if the problem is gone, and then slowly enable them until you find the culprit, if the names of any of them don’t jump out as something that might be causing a problem like this.

0 Likes

#6

Greetings!

I hope this finds you well. I’m having a similar problem with snippets, and it’s occurring before and after any third party packages are installed.

The issue is simply that, when there are several snippets with the same tab trigger, the snippet menu that popped up in ST3 (displaying the various snippet choices and their descriptions) isn’t popping up in ST4. It seems to simply be choosing the snippet furthest down the alphabet (according to their filenames).

For example, I have 5 snippets, all with the same tab trigger:

<tabTrigger<.align.</tabTrigger<

(had to use only < here or else they’re hidden in the post)

When I set this off in ST3, I’d get a menu listing the choices and descriptions, and then could mouse to the one that I want. ST4 is like “I’m not showing you the list and I’m just givin ya the last one, peace out.”

If you folks have time, I’d really appreciate ya takin a look. Thanks in advance, and take care.

Cheers!

1 Like

#7

I can’t replicate that here; have you tried in Safe Mode just to verify that there’s not some package (or a plugin/key binding in your User folder) that’s getting in the way?

0 Likes

#8

Thanks for the quick response! I appreciate it. I tried it out, still doesn’t seem to change.

  • In safe mode: there’s no snippet response at all, simply tabs the cursor over

  • On a fresh clean install with no packages or settings: no difference.

  • On a a fresh install on an identical computer: no difference.

Runnin this on the latest Windows 10 vs. 21H1, 19043.1052 if that makes a difference. Thanks in advance!

1 Like

#9

I had the same problem and the fix for me was to restore the Tab keybinding from the default into the User settings. For some reason, user keybindings changed after the update and Tab and Enter functionalities were altered (some functionalities were missing).

0 Likes

#10

@alipasha

Thanks Ali. Would you say a little more about what you did? I’ve tried different combinations of copying the [tab] keybindings from default to user (all of them, those from ST3 into ST4, those missing from ST4 into it from ST3). Can’t seem to get it right.

Cheers!

0 Likes

#11

I copied all the tab bindings I found (looked up “tab”) in the Default onto the User settings file (all in ST4). Some were missing so once the issue was resolved, I did not look further into what the cause was. However, I noticed that the order in which the bindings appear in the settings file seems to matter. Before the snippets, I had the issue that the Tab was not “tab-ing”.

0 Likes

#12

Note however that Sublime should work just find without any bindings whatsoever in the User key binding file (with the exception that on some foreign language keyboards, some keys may not trigger like you think and you may want to remap them).

If copying the bindings from the Default to your User package fixes the problem, then the issue is that you have a package installed that’s overriding the bindings.

Additionally, if you look in the Default bindings and don’t see the bindings that other people say are there, you’ve overridden the defaults and are blocking the new version of the file from ST4 from taking effect.

0 Likes

#13

Well gentlemen, nope. Not for me. Y’all tried though, and I appreciate that.

Definitely not a package interference problem. Just did clean install #5, and there is literally nothing in the packages or user folders except for 3 snippets I just put there.

I’m guessing it’s a Windows 10 21H1 thing. Bummer. ST4 looks so sweeeeeeeet. I am sure with time.

Cheers!

0 Likes

#14

Build 4109 seems to have sort of fixed the issue. I still don’t see the snippet suggestion in the autocomplete menu. So, I just type the letters of the tab trigger, then hit Esc to ignore the offered suggestions and then hit Tab and it works.

The “proto” snippet for JavaScript works as well with the same sequence. I type proto, then hit Esc to hide offered suggestions and then hit Tab and I get the snippet.

Not the behavior I’m used to but at least its working now :slight_smile:

0 Likes

#15

Hello all.

It seems I’m having the same issue since the update from ST3 to ST4, I’m on macOS 11.4, ST 4113.

  • I do not use any extra package;
  • With the same configuration, in ST3, hitting tab on a snippet tabtrigger opens the selection menu, on ST4 it just auto completes with one of the snippets (the last file from the set of filenames using the same tabtrigger apparently.);
  • I reproduce the issue in safe mode (by copying my *.sublime-snippet files into the safe mode conf directory);
  • If I use the menu Tools > Snippets then I see all my snippets in the list and can select any of them correctly, so the problem is only related to tab completion, apparently;

The only related tweak I have is to disable auto_complete (“auto_complete”: false in the settings) as I don’t want the menu while typing.

I tried to toggle tab_completion and changing from true to false does not change anything — the behavior is the same whereas false is supposed to always open the menu according to the comments, so it looks like there’s a problem here?

Also on top of that, it seems the tabtrigger “#” is no longer supported correctly, because with tabtrigger, even with auto_complete=true, no menu show up, whereas with a tabtrigger like “if”, the menu shows up.

1 Like

#16

All completions from sublime-completions files not providing any “kind” information are displayed as “snippets”. That’s the choosen default / fallback kind.

0 Likes

#17

This is what worked for me:

The “tab” key was set to auto-complete from an autocomplete list whenever the autocomplete was visible. I removed that keybind, and it started working again. Look in your “Tools -> Snippets” to make sure your snippet is recognized. Mine was.

0 Likes