2016-09-02 12 views
0

Atomエディタでカスタムスニペットの作業をしようとしています。アトムスニペットがscssの複数行スニペットで動作しない

# Your snippets 
# 
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to 
# expand the prefix into a larger code block with templated values. 
# 
# You can create a new snippet in this file by typing "snip" and then hitting 
# tab. 
# 
# An example CoffeeScript snippet to expand log to console.log: 
# 
# '.source.coffee': 
# 'Console log': 
#  'prefix': 'log' 
#  'body': 'console.log $1' 
# 
# Each scope (e.g. '.source.coffee' above) can only be declared once. 
# 
# This file uses CoffeeScript Object Notation (CSON). 
# If you are unfamiliar with CSON, you can read more about it in the 
# Atom Flight Manual: 
# https://atom.io/docs/latest/using-atom-basic-customization#cson 
'.text.html.basic': 
    'Bootstrap css link': 
    'prefix': 'bootstrap' 
    'body': '<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">$1' 

    'Vue minified': 
    'prefix': 'vuemin' 
    'body': '<script src="https://cdn.jsdelivr.net/vue/latest/vue.min.js"></script>$1' 

    'Vue develompent': 
    'prefix': 'vuedev' 
    'body': '<script src="https://cdn.jsdelivr.net/vue/latest/vue.js"></script>$1' 

    'Placehold img': 
    'prefix': 'ph' 
    'body': '<img src="https://placehold.it/$1" alt="">' 
    'Telephone': 
    'prefix': 'tel' 
    'body': '<a href="tel:+48888888888$1">+48 888 888 888</a>' 

'.source.css.scss': 
    'Breakpoint Foundation': 
    'prefix': 'bp' 
    'body': """ 
     @include breakpoint($1) { 
     $2 
     } 
    """ 

'.source.css.scss': 
    'Breakpoint Foundation Medium': 
    'prefix': 'bpm' 
    'body': """ 
     @include breakpoint(medium) { 
     $1 
     } 
    """ 

'.source.css.scss': 
    'Breakpoint Foundation Large': 
    'prefix': 'bpl' 
    'body': """ 
     @include breakpoint(large) { 
     $1 
     } 
    """ 

    'Kentico comment': 
    'prefix': 'kc' 
    'body': '/*#$1#*/' 

すべてがこの部分を除いて、[OK]作品:私はSCSSファイルを編集する場合は、のみbplkcスニペットが動作している

'.source.css.scss': 
    'Breakpoint Foundation': 
    'prefix': 'bp' 
    'body': """ 
     @include breakpoint($1) { 
     $2 
     } 
    """ 

'.source.css.scss': 
    'Breakpoint Foundation Medium': 
    'prefix': 'bpm' 
    'body': """ 
     @include breakpoint(medium) { 
     $1 
     } 
    """ 

'.source.css.scss': 
    'Breakpoint Foundation Large': 
    'prefix': 'bpl' 
    'body': """ 
     @include breakpoint(large) { 
     $1 
     } 
    """ 

これは私のsnippets.csonファイルです。 1.10.0 Atomには、1.11.0オートコンプリートスニペットと1.0.2スニペットプラグインがあります。

+0

サンプルを短くして、質問に関連しないすべてのコメントとスニペットを削除してください。 – idleberg

答えて

1

同じスコープを共有するすべてのスニペットをグループ化する必要があります。そうしないと、以前のインスタンスは後のインスタンスで上書きされます。

'.source.css.scss': 
    'Breakpoint Foundation': 
    'prefix': 'bp' 
    'body': """ 
     @include breakpoint($1) { 
     $2 
     } 
    """ 
    'Breakpoint Foundation Medium': 
    'prefix': 'bpm' 
    'body': """ 
     @include breakpoint(medium) { 
     $1 
     } 
    """ 
    'Breakpoint Foundation Large': 
    'prefix': 'bpl' 
    'body': """ 
     @include breakpoint(large) { 
     $1 
     } 
    """ 

一つは、Atomはこれらのキーをマージするべきであると主張する人もいるかもしれないが、それは開発者とdiscussionを負いません。

関連する問題