babel / babel-sublime-snippets

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

Only few triggers are working #15

Open v1rt opened 8 years ago

v1rt commented 8 years ago

There are many triggers missing. The only thing that works for me are

rcc ren fdn sst props state

The other triggers are not working. What am I missing?

Fyi, this is my Babel Snippets directory - http://i.imgur.com/tnaMFPO.jpg

haani104 commented 8 years ago

Same is the case with me, only below are working

rcc (legacy) rcc (class) fdn sst props state

I am using sublime Build 3083

lukaskwkw commented 8 years ago

@v1rt @haani104 try replace default ... to something like this
source.js meta.group.braces.round meta.group.braces.curly -(meta meta meta) in babel snippets folder .config/sublime-text-3/Packages/Babel Snippets of triggers which don't work. At least it worked for my rcc trigger.

kurten commented 8 years ago

Component api only work on example: class Test extends React.Component { // here

... // other code },

gdp gis ren scu only work in ({ }), Limited by scope meta. Have fun :).

rickgaurav commented 6 years ago

Basically you have to take a look at scopes for particular snippets that are not working. Example: cdm triggers componentDidMount, but it wasn't working for me. I looked at the snippet files.

There are 2 files for this.

  1. react_componentDidMount.sublime-snippet The scope for this snippet is defined as <scope>source.js meta.group.braces.round meta.group.braces.curly -(meta meta meta)</scope> What it means is that this trigger will only work inside ({}) in any javascript file. For Eg. Open any JS file , create a block with ({}) and type cdm inside it and tab, it will create componentDidMount.

  2. reactcomponentDidMount(class).sublime-snippet: This is basically meant to cater to the new style of creating React Components using ES6 class keywords. Scope for this is: <scope>source.js meta.class.js -(meta meta)</scope> It means cdm trigger will work inside class in any javascript file(inferred from source.js) So tabbing cdm will work inside any component that is specifically created using the Class keyword.

Hope this helps in understanding the issue better.