babel / babel-sublime-snippets

Next generation JavaScript and React snippets for Sublime
https://babeljs.io
262 stars 47 forks source link

I tried cdm command but it didn't work #9

Closed c0debreaker closed 9 years ago

c0debreaker commented 9 years ago

so I added this to my key binding

  {
    "keys": ["ctrl+shift+,"],
    "command": "insert_snippet",
    "args": {
      "name": [ 
        "Packages/Babel Snippets/react_wrap.sublime-snippet",
        "Packages/Babel Snippets/react_componentDidMount_(class).sublime-snippet"
      ]
    }
  }
zertosh commented 9 years ago

"name" must be a string not an array. react_componentDidMount_(class).sublime-snippet should just work out-of-the-box. However, it's scoped to only work inside a class body. react_wrap.sublime-snippet does need a keybinding (or you can use it without one via the command palette). You first need to select the thing you want wrapped in a component, and then run the snippet.

c0debreaker commented 9 years ago

Would that mean that I will have 2 entries? How about this?

{
    "keys": ["ctrl+shift+,"],
    "command": "insert_snippet",
    "args": {
      "name": "Packages/Babel Snippets/react_wrap.sublime-snippet"
    }
},
{
   "command": "insert_snippet",
    "args": {
      "name": "Packages/Babel Snippets/react_componentDidMount_(class).sublime-snippet"
    }
}
c0debreaker commented 9 years ago

Disregard my question, the cdm works now :D Thank you for mentioning class. That helped a lot!!!