Why isn't doesn't this snippet work?


My snippets file has 4 snippets that have the same scope, with different titles, triggers and bodies. For some reason the 2nd to last one isn’t triggering whenever I have my last snippet there also. Renaming the titles and triggers doesn’t fix this issue.

2nd to last snippet:

  "If Exists":
    'prefix': 'IfEx'
    if [ -e /some/dir ]
      ${1:echo "doing this"}
      ${2:echo "It wasn't found"}

Last snippet

  "If it Doesn't Exists":
    'prefix': '!IfEx'
    if [ ! -e /some/dir ]
      ${1:echo "doing this"}
      ${2:echo "It was found"}

Which version of Atom are I using?

What OS and version are I running?
Linux Mint 17.1 with the Linux 3.13.0-37-generic kernel

Do you have the Shadow DOM feature enabled?

Do I have the Emmet package installed?

Can I reproduce the issue after completely exiting Atom and restarting using atom --safe?


CSON, like JSON, is an Object Notation. It consists of keys and structured values. If you specify two or more copies of the same key … the last copy overwrites the previous ones, not adds to it.

It sounds like you have:

  "If Exists":
    # snip
  "If it Doesn't Exists":

Notice that you have two copies of the '.source.shell' key. If you change it to:

  "If Exists":
    # snip
  "If it Doesn't Exists":

things will work fine.


That works; thanks.


Very few parsers check for this which is a real problem. I can’t think of a situation where you aren’t losing data when you have duplicates.


I have a similar question.
That’s my snippet:
‘html’: ‘html’
‘prefix’: ‘html’
‘body’: ‘skeletal structure of html, that i want to use

The snippet works on my Laptop. But on the Computer in my School the snippet adds an other structure. In the snippet.cson is no other snippet and i found no package that could explain this.

Hope my english is okay and I would enjoy if someone could help me (and if i have some bad phrases, it would be nice when someone could tell me how it would be better).

Greetings Chikako


Your snippet should be written as

    prefix: 'html'
    body: '<html></html>'


Thanks but it doesn’t work.

Thats what I wrote:

> 'body': '<!DOCTYPE html>\n<html lang="de">\n\n\t<head>\n\t\t<meta charset="utf-8">\n\t\t<title></title>\n\t\t<link rel="stylesheet" type="text/css" href="">\n\t</head>\n\n\t<body>\n\n\t</body>\n\n</html>'

And thats the result:

<!DOCTYPE html>
<html lang="en" dir="ltr">
    <meta charset="utf-8">

Could there is a predefined Snippet which isn’t in the cson? I also deactivate all “autocomplete” Packages without success.



I see no problem with what you are trying to do. Even with the prefix was html - no problem.

My preference is with using the triple quote """ and having a more closely what-you-see-is-what-you-get style. :thinking: you did save the snippet file before trying to use it - right?



Yes, I saved it. I closed Atom and start it again and watched in the file. My snippet was saved but didn’t work… but i found some autocomplete-packages for html, maybe there is the one that blocked my snippet.


What happens if you press esc to close the autocomplete popup, and then press tab to expand the snippet?


Your snippets.cson file should take priority over any snippets defined by packages. autocomplete-plus providers don’t generally carry snippets with them, so you’re not competing with those.

Mind providing a screenshot of your whole snippets.cson file?


Thank you for your feedback.

Additional to what @Aerijo and @DamnedScholar said ->

Please name the prefix to something unique. Call it aaa or something strange. Then try to use that instead of the word html. This will indicate that the user snippets file is working as expected.

If this temporary plan does not work, then we know to look for the problem in the scope name or some error anywhere inside the user snippet file.