Snippet Like Sublime Text


#1

when I type cc+tab this should actually come →

/**


  • 1.0 Define Constants.

*/

Please guide me how to write this snippet?

what should I write in snippet.cson?

I tried this →

'.source.php':
  'comments':
    'prefix': 'cc'
        'body': """
            /*------------------------------------*
            ::$1
            \*------------------------------------*/
            $2

But didnt worked.


#2

You snippet is missing """ to end the multi line syntax block and the body should be on the same indentation level as the prefix. You can read about snippets in the Atom Flight manual.

This should expand to your example:

'.source.php':
  'comments':
    'prefix': 'cc'
    'body': """
        /**
        * ------------------------------------
        * $1
        *------------------------------------
        */
        $2"""

#3

Yes Boss. It worked.


#4

Now the 2nd part is not working →

> '.source.php':
>   'comments':
>     'prefix': 'cc'
>     'body': """
>         /**
>         * ------------------------------------
>         * The Fuck $1
>         *------------------------------------
>         */

>         $2"""

>     'comments1':
>       'prefix': 'cc1'
>       'body': """
>           /*---------------------------------------*/
>           /* 5. REGISTER WIDGET AREAS */ $1
>           /*---------------------------------------*/

>           $2"""

I mean this part →

'comments1':
>       'prefix': 'cc1'
>       'body': """
>           /*---------------------------------------*/
>           /* 5. REGISTER WIDGET AREAS */ $1
>           /*---------------------------------------*/

>           $2"""

#5

comments1 should be at the same indentation level as comments.