Problems adding code snippets


#1

Ive been trying to add a snippet to my cloud9 workspace, following the guide at https://cloud9-sdk.readme.io/docs/snippets

When I start typing I can see the snippet in the autocomplete, but when I hit tab nothing happens.

Anyone had any experience with getting snippets to work?

Thank you


#2

If you don’t mind, please share the code you wrote to register the snippets so we can double check it’s okay.


#3

I’m having the same problem. The snippet appears in the autocomplete drop down but when I hit tab nothing happens.

I’m running my work space in debug mode.
From the file menu, I’m choosing New Plugin | Cloud9 Bundle.

Here is how I have things setup:

Not sure if it’s necessary, but I added the javascript.js file from here:
snippets at github

Thanks,

Taji


#4

Nice and simple test:-

<snippet>
<content>
Banannas are cool
</content>
<tabTBanrigger>Banannas<\tabTrigger>
</snippet>

#5

Edit: Thanks for the help. :smile:

I tried your snippet as so:

Same result. I see the snippet appear in the drop down list but when I hit the tab key the name of the snippet autocompletes but I never see “Banannas are cool”.

Can you provide more detail? What kind of file should this be stored in (xml?). What is the file extension (.xml or .snippet?). Should it be placed in the snippets folder? Why is this xml format you have different than the one described here in the documentation?:

Thanks,


#6

The format for snippets is based on Vim. There are a lot of examples available at https://github.com/ajaxorg/ace/tree/master/lib/ace/snippets

For your definition above, it would look like this:

snippet Banannas
	Banannas are cool

snippet apples
	apples are ${1:delicious} fruit

#7

I tried your two snippets (Bananas and apples) and neither autocomplete. Here is how I have it setup:

Does this look right? My workspace is here:

https://ide.c9.io/taji/nod-test

I’m typing the snippet trigger apple into the server.js file. Can you take a look?

Thanks,

Taji.


#8

the # scope: javascript comment at the top is required, but javascript.js file isn’t.

The snippet appears in the autocomplete drop down but when I hit tab nothing happens.

the issue seems to be caused by the way completions are sorted in autocomplete dropdown
entry from word completer gets higher priority than the snippet and replaces it.
If that’s the case the little icon and gray snippet text should be missing from the completion

pressing tab with popup closed should still expand the snippet


#9

Same issue here. How can I fix this?


#10

Hi xoob,

Sounds cool, but where do I have to write those definitions in c9?

Cheers,

Zsolt