Sublime Forum

Spcae not responding on first time in snippet

#1

Hello, I have the below snippet for PHP
<content><![CDATA[ function $1 ($2) { $0 } ]]></content>

The output is function () { }

The problem is that when I am in position $1, nothing happens when I press space, it only adds space when I hit the second time. Why???

0 Likes

#2

I can’t reproduce this in build 4137. Does it happen in safe mode?

0 Likes

#3

I cannot see my custom snippet during safe mode. I have realized that this happens to all custom snippets and all edited default snippets by this method where the first position isn’t responding on space key for the first time.

Can you confirm the format is correct and no mistake here:

<snippet>
	<content><![CDATA[
function $1 ($2) {
	$0
}
]]></content>
	<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
	<tabTrigger>function</tabTrigger>
	<!-- Optional: Set a scope to limit where the snippet will trigger -->
	<scope>source.php</scope>
	<description>function ... () { ... }</description>
</snippet>
0 Likes

#4

For trying safe mode you need to create the snippet after launching ST in safe mode.

0 Likes

#5

I can reproduce this in ST 4137 safe mode with the snippet provided in Spcae not responding on first time in snippet . The first space press doesn’t trigger any command.

1 Like

#6

I have just tried that in safe mode, the space key isn’t doing anything for the first time in the first position…

This happens not only to custom snippets but default snippets that are edited by this method is also the same…

0 Likes

#7

I can reproduce the first space after committing snippet being ignored with the snippet above.

  • ST4137 (SAFE MODE) on Win11

Steps:

  1. type function
  2. hit tab key -> commit_completion is invoked
  3. hit space -> key input is logged, nothing happens
  4. hit space -> key input is logged, space is inserted
1 Like

#8

We’ve got a fix for this in the pipeline.

1 Like