nl_tokens: Expands abbreviation into a snippet
pl_tokens: function ( abbr , value , syntax ) { syntax = syntax || 'css' ; var resources = require ( 'resources' ) ; var autoInsertPrefixes = prefs . <mask> ( 'css.autoInsertVendorPrefixes' ) ; // check if snippet should be transformed to !important var isImportant ; if ( isImportant = / ^(.+)\!$ / . test ( abbr ) ) { abbr = RegExp . $1 ; } // check if we have abbreviated resource var snippet = resources . findSnippet ( syntax , abbr ) ; if ( snippet && ! autoInsertPrefixes ) { return transformSnippet ( snippet , isImportant , syntax ) ; } // no abbreviated resource, parse abbreviation var prefixData = this . extractPrefixes ( abbr ) ; var valuesData = this . extractValues ( prefixData . property ) ; var abbrData = _ . extend ( prefixData , valuesData ) ; if ( ! snippet ) { snippet = resources . findSnippet ( syntax , abbrData . property ) ; } else { abbrData . values = null ; } if ( ! snippet && prefs . get ( 'css.fuzzySearch' ) ) { // let’s try fuzzy search snippet = resources . fuzzyFindSnippet ( syntax , abbrData . property , parseFloat ( prefs . get ( 'css.fuzzySearchMinScore' ) ) ) ; } if ( ! snippet ) { snippet = abbrData . property + ':' + defaultValue ; } else if ( ! _ . isString ( snippet ) ) { snippet = snippet . data ; } if ( ! isSingleProperty ( snippet ) ) { return snippet ; } var snippetObj = this . splitSnippet ( snippet ) ; var result = [ ] ; if ( ! value && abbrData . values ) { value = _ . map ( abbrData . values , function ( val ) { return this . normalizeValue ( val , snippetObj . name ) ; } , this ) . join ( ' ' ) + ';' ; } snippetObj . value = value || snippetObj . value ; var prefixes = abbrData . prefixes == 'all' || ( ! abbrData . prefixes && autoInsertPrefixes ) ? findPrefixes ( snippetObj . name , autoInsertPrefixes && abbrData . prefixes != 'all' ) : abbrData . prefixes ; var names = [ ] , propName ; _ . each ( prefixes , function ( p ) { if ( p in vendorPrefixes ) { propName = vendorPrefixes [ p ] . transformName ( snippetObj . name ) ; names . push ( propName ) ; result . push ( transformSnippet ( propName + ':' + snippetObj . value , isImportant , syntax ) ) ; } } ) ; // put the original property result . push ( transformSnippet ( snippetObj . name + ':' + snippetObj . value , isImportant , syntax ) ) ; names . push ( snippetObj . name ) ; if ( prefs . get ( 'css.alignVendor' ) ) { var pads = require ( 'utils' ) . getStringsPads ( names ) ; result = _ . map ( result , function ( prop , i ) { return pads [ i ] + prop ; } ) ; } return result ; }