atom / snippets

Atom snippets package
MIT License
205 stars 101 forks source link

multiple cursor per snippet #133

Closed markusfalk closed 9 years ago

markusfalk commented 9 years ago

It would be awesome if I could use multiple cursor with the same ID like so:

'.source.html':
  'commented div':
    'prefix': 'div'
    'body': '<div class="$1"></div> <!-- $1 -->'

Thank you :)

lee-dohm commented 9 years ago

I just tested it with the following snippet:

'.source.gfm':
  'Test':
    prefix: 'test'
    body: 'foo$1bar$1'

and it works just fine :grinning:

multi-cursor-snippet

Is there something that isn't working for you?

markusfalk commented 9 years ago

The one I showed you above won't work. It only shows one cursor and leaves out the html comment.

The result looks like this:

<div class="|">

</div> 

First I thought this is because of emmet but I deactivated it. Same results. What information would help you to maybe have a look at the problem?

lee-dohm commented 9 years ago

I figured out what the problem is...

The base scope for HTML is .text.html.basic, not .source.html. You can find this information on the settings page for the language package or by executing the command "Editor: Log Cursor Scope" when your cursor is where you want the snippet to execute.

So if you use the following snippet definition:

'.text.html.basic':
  'commented div':
    'prefix': 'div'
    'body': '<div class="$1"></div> <!-- $1 -->'

things should work just fine.

Please let me know if you run into any more issues :grinning:

markusfalk commented 9 years ago

Thank you! :)