Raghunathan
Raghunathan

Reputation: 61

Atom Snippets - Getting saved but not listed and doesn't work

My snippets.cson file :

'source.css':
 'Default':
  'prefix':'dcss'
  'body':"""
  *
  {
    padding : 0;
    margin : 0;
     $1
  }
"""

When I save this file, I get no error, but when I type "dcss" and hit tab. Nothing seems to appear.

I've read through this;

https://github.com/atom/atom/issues/1867

and implemented it as well it still doesn't seem to work

The snippets.cson file Snippet not listed

I am running Atom in safe mode so that the init script doesn't interfere.

Thanks in Advance.

Upvotes: 1

Views: 105

Answers (1)

idleberg
idleberg

Reputation: 12882

There are two mistakes in your snippet:

  1. Syntax scopes in Atom are prefixes with a dot, so your prefix should be .source.css

  2. CSON is sensitive on indentation, so you need to make sure it's consistent (the closing """ aren't indented correctly).

Put together, your snippet should look like this:

'.source.css':
  'Default':
    'prefix': 'dcss'
    'body':"""
      *
      {
        padding : 0;
        margin : 0;
        $1
      }
    """

Upvotes: 1

Related Questions