Some snippets files not loading from snippets package package [RESOLVED]


#1

Currently I’m working on a snippets package for the Java language.

Details:

  • Atom version: 1.13.0
  • OS: MacOS Sierra latest (10.12.2)

I have 5 snippet files, 3 of which work & are being loaded (image below)

Strange things are:

  • I’m not getting any console errors in the Chrome dev tools
  • If I move one of these same snippets into my snippets.cson it works (GIF below)
  • I noticed atom’s language-java package’s snippets folder containing language-java.cson has their snippets written in a certain way, that is everything is on one line.

So something inside of these 2 files are is breaking my snippets, I just don’t know what. I had no snippet issues with the atom-mysql-snippets package I made.

Question:

  • inside of my multiline snippets, should I be doing something like this:
  "class":
    "prefix": "class"
    "body": """
	 ${1:public} class ${2:ClassName} {
       ${3}
     }$4
     """

or using characters’s like \t

  "class":
    "prefix": "c"
    "body": """
    class ${1:name} {
    \tconstructor(${2:arguments}) {
    \t\t${0}
    \t}
    }
    """

I noticed Most of atom core’s language packages write their snippets in one like like so (this is for atom-language java or atom-language-javascript):

'class':
    'prefix': 'cl'
    'body': 'class ${1:MyClass} ${2:extends ${3:Parent} }${4:implements ${5:Interface} }{\n\t$6\n}'

My snippets code is here https://github.com/cliffordfajardo/atom-java-snippets/

If you download my java snippets package, are all of the snippets showing up in the snippet settings for you?

Honestly don’t know what to do to resolve, this it feels like these snippets are hit or miss. Any help/tips would be greatly appreciated.

Thanks & cheers🎉!


#2

To solve my issue with snippets I ended up following the one-line format for snippets like so:

'class':
    'prefix': 'cl'
    'body': 'class ${1:MyClass} ${2:extends ${3:Parent} }${4:implements ${5:Interface} }{\n\t$6\n}'

The multi-line way with """ was causing me problems