Sublime Forum

Can't make my snippets

#1

Hello,

I’m trying to make some snippets for C# but it behaves like I’m not editing the right files. :cry:

I made a if.sublime-snippet in *C:\Documents and Settings\eric\Application Data\Sublime Text\Packages\C#* as follows:

<!-- See http://www.sublimetext.com/docs/snippets for more information -->
<snippet>
	<content><![CDATA[
if (${0:$SELECTION})
{
	${1} // alala alala 
}
${2}
]]></content>
</snippet>

And Default.sublime-keymap in the same dir is:

	<binding key="i,f,tab" command="insertSnippet 'Packages/C#/if.sublime-snippet'">
		<context name="selector" value="source.cs"/>
	</binding>

the “// alala alala” test thing don’t come when I call the snippet

Any one can help me please?

thanx in advance!

0 Likes

#2

This is a bug in sublime: in the Packages/C++/Default.sublime-keymap, the entry is:

<bindings>
	...
	<binding key="i,f,tab" command="insertSnippet 'Packages/C++/if.sublime-snippet'">
		<context name="selector" value="source.c++, source.c"/>
	</binding>
</bindings>

The “source.c” entry there is overriding your “source.cs” entry.

You can remove the “source.c” part of the above keymap, and it’ll work.

0 Likes

#3

oh thanks!

it doesn’t matter, tha basic ones, I will keep with C++.

:wink:

0 Likes