2

I've come across a few posts online but still befuddled and nothing concrete. Maybe someone can decode the below for me, seems like they figured it out but I've never made a plugin before so not sure where to start. Maybe can outline a file structure and I can take it from there? Thanks in advance

https://community.c9.io/t/snippets-not-working-in-c9/19215/3

1 Answers1

3

I could not get plugins to load using the external url method, but loading plugins locally works.

You need to create a new plugin

mkdir -p ~/.c9/plugins/myPlugin/snippets;
cd ~/.c9/plugins/myPlugin/snippets;
printf '# scope: javascript\nsnippet test\n\tif (${1:true}) {\n\t\t${2}\n\t}\n\t$0' > javascript.snippets;
echo '{"name":"myPlugin", "plugins": {}}' >  ../package.json

Then open your init script (click on AWS Cloud9 > Open Your Init Script in the menu bar) and add code for loading the plugin

services["language.complete"] = services["languageComplete"];

services.pluginManager.loadPackage([
    "~/.c9/plugins/myPlugin/package.json",
])

To add more snippets edit ~/.c9/plugins/myPlugin/snippets/javascript.snippets

NOTE: snippet file needs to be indented with tabs not spaces

I pieced this together from the two links below.

How to load plugins locally: https://community.c9.io/t/snippets-not-working-in-c9/19215/3

Fix for AWS not loading snippets: https://forums.aws.amazon.com/thread.jspa?threadID=299949&tstart=0

benlarkins
  • 86
  • 4
  • I'm just trying out Cloud9 editor with a remote server using SSH connection. Does this mean I have to copy the snippets to every remote server if I use multiple servers. Is there an option to create your own snippets once in a central location and reuse it for muiltiple remote servers? – A.W. Sep 09 '20 at 17:05