Atom Editor: multiple snippets

后端 未结 6 1180
孤街浪徒
孤街浪徒 2020-12-31 03:11

This is such a simple question but I can\'t find any documentation besides the readme.

How can I have multiple custom snippets in Atom Editior:

For example I

6条回答
  •  感情败类
    2020-12-31 03:44

    I had the same problem, here is the fix:

    '.source.js':
      'First function':
        'prefix': 'first'
        'body': """
        function $1() {
          var overall = true;
          if (overall)
          {
            var result = {};
            result.test1 = "";
            return test2(result);
          }
          return catched("");
        } """,
    
      'Next function':
        'prefix': 'next'
        'body': """
        function $1(result) {
          var overall = true;
          if (overall)
          {
            result.test1 = "";
            return test2(result);
          }
          return catched("");
        } """,
    
      'Next next function':
        'prefix': 'pz'
        'body': """
        function $1(result) {
          var overall = true;
          if (overall)
          {
            result.test1 = "";
            return test2(result);
          }
          return catched("");
        } """
    

    Please note that you have to do a couple of things:

    1. Add comma (,) after each """.
    2. Start the next define in the same start line of the prev define! I really did not understand why it works like that.. but.. that is the case.
    3. Use '.source.PROGRAM LANGUAGE': only once per language.

    Home it helps :)

提交回复
热议问题