i trying working custom snippets in atom editor. snippets.cson file:
# snippets # # atom snippets allow enter simple prefix in editor , hit tab # expand prefix larger code block templated values. # # can create new snippet in file typing "snip" , hitting # tab. # # example coffeescript snippet expand log console.log: # # '.source.coffee': # 'console log': # 'prefix': 'log' # 'body': 'console.log $1' # # each scope (e.g. '.source.coffee' above) can declared once. # # file uses coffeescript object notation (cson). # if unfamiliar cson, can read more in # 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#*/'
everything works ok except part:
'.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 } """
when editing scss file, bpl
, kc
snippet working. have 1.10.0 atom 1.11.0 autocomplete-snippets , 1.0.2 snippets plugins.
you need group snippets share same scope, otherwise previous instances overwritten later ones.
example:
'.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 } """
one might argue atom should merge these keys, bears discussion developers.
Comments
Post a Comment