Tab performing editor indent rather than Emmet or Snippet


#1

When I use Cmd+. to see what editor functions are mapped to a keypress I see the following list:

editor:indent
emmet:expand-abbreviation-with-tab
snippets:next-tab-stop
snippets:expand

The situation is that I’m in an .html.erb file, I type a % and press tab expecting it to use my snippet of:

'.text.html.erb':
  'ERB Block':
    'prefix': '%'
    'body': '<% $1 %>'

But instead I get a % symbol followed by spaces to indent. If I use Cmd+Opt+P I get [“text.html.erb”] in the console.

Any ideas on what I’m doing wrong or if this is a bug?


#2

I just ran a quick test using the img snippet in Markdown:

I then added the following to my snippets.cson:

'.source.gfm':
  'Test':
    prefix: '%'
    body: '%test'

And it worked as expected. Do you have more than one section named .text.html.erb in your snippets.cson? If so, only the last one will “win”.


#3

You’re a superstar! For some reason I didn’t consider the issue of having multiple sections (even though it’s obvious now I think of it).

Thanks, all working fine now!


#4

While this isn’t exactly a common issue, this isn’t the first time this has come up (which is why I thought to ask :grinning:). Would you mind creating an Issue on the snippets package for a Deprecation Cop-like view that would pop up in situations like this?

I’m on my way to a meeting or I’d do it. I just don’t want it falling in the cracks.


#5

No problem mate, done https://github.com/atom/snippets/issues/72