atom / language-todo

TODO highlighting package for Atom
Other
80 stars 66 forks source link

Snippets #8

Closed dsandstrom closed 10 years ago

dsandstrom commented 10 years ago

How do you guys feel about adding snippets?

What is the best way? Different snippets for each comment type? Something like this:

'.source.ruby, .source.coffee':
  'todo':
    'prefix': 'todo'
    'body': '# TODO: $0'
  'fixme':
    'prefix': 'fix'
    'body': '# FIXME: $0'
  'xxx':
    'prefix': 'xxx'
    'body': '# XXX: $0'
'.text.haml':
  'todo':
    'prefix': 'todo'
    'body': '-# TODO: $0'
  'fixme':
    'prefix': 'fix'
    'body': '-# FIXME: $0'
  'xxx':
    'prefix': 'xxx'
    'body': '-# XXX: $0'

To drag out a dead horse, Sublime has a constant that matched to comments for each language. So my solution was:

<snippet>
  <content><![CDATA[$TM_COMMENT_START${2:TODO}: ${1:}$TM_COMMENT_END]]></content>
  <tabTrigger>todo</tabTrigger>
</snippet>

Is something like that possible?

kevinsawicki commented 10 years ago
<snippet>
  <content><![CDATA[$TM_COMMENT_START${2:TODO}: ${1:}$TM_COMMENT_END]]></content>
  <tabTrigger>todo</tabTrigger>
</snippet>

This is not currently possible.

The snippets you listed sound good, want to open a PR?

dsandstrom commented 10 years ago

Ok.

Related: https://github.com/atom/snippets/issues/46

dsandstrom commented 10 years ago

I will be adding more as I need them (and others should do the same).

kevinsawicki commented 10 years ago

Fixed by #9