LoginSignup
6
6

More than 5 years have passed since last update.

Atom の snippets.cson の書き方の注意点

Last updated at Posted at 2014-06-15

.atom/snippets.cson に複数の snippet を登録しようとしてはまりました。。
以下のように snippet を登録するのは誤りです。

snippets.cson
# 間違い!! log1 は有効になりません。
'.source.js':
  'log1':
    'prefix': 'l'
    'body': 'console.log($1);'

'.source.js':
  'log2':
    'prefix':'cl'
    'body': 'console.log($1);'

上のように書くと、最後の snippet しか有効になりません。
正しくは、下のように '.sources.js' にまとめて書きます。

snippets.cson
'.source.js':
  'log1':
    'prefix': 'l'
    'body': 'console.log($1);'
  'log2':
    'prefix':'cl'
    'body': 'console.log($1);'

もう一つ注意点として、上の log1log2 を同じ文字列にしてしまうと、最後の定義しか有効になりません。

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6