src/extensions/default/CSSCodeHints/main.js
function formatHints(hints, query) {
        var hasColorSwatch = hints.some(function (token) {
            return token.color;
        });

        StringMatch.basicMatchSort(hints);
        return hints.map(function (token) {
            var $hintObj = $("<span>").addClass("brackets-css-hints");

            // highlight the matched portion of each hint
            if (token.stringRanges) {
                token.stringRanges.forEach(function (item) {
                    if (item.matched) {
                        $hintObj.append($("<span>")
                            .text(item.text)
                            .addClass("matched-hint"));
                    } else {
                        $hintObj.append(item.text);
                    }
                });
            } else {
                $hintObj.text(token.value);
            }

            if (hasColorSwatch) {
                $hintObj = ColorUtils.formatColorHint($hintObj, token.color);
            }

            return $hintObj;
        });
    }
function formatHints(hints, query) {
        var hasColorSwatch = hints.some(function (token) {
            return token.color;
        });

        StringMatch.basicMatchSort(hints);
        return hints.map(function (token) {
            var $hintObj = $("<span>").addClass("brackets-css-hints");

            // highlight the matched portion of each hint
            if (token.stringRanges) {
                token.stringRanges.forEach(function (item) {
                    if (item.matched) {
                        $hintObj.append($("<span>")
                            .text(item.text)
                            .addClass("matched-hint"));
                    } else {
                        $hintObj.append(item.text);
                    }
                });
            } else {
                $hintObj.text(token.value);
            }

            if (hasColorSwatch) {
                $hintObj = ColorUtils.formatColorHint($hintObj, token.color);
            }

            return $hintObj;
        });
    }
function formatHints ( hints , query ) { var hasColorSwatch = hints . some ( function ( token ) { return token . color ; } ) ; StringMatch . basicMatchSort ( hints ) ; return hints . map ( function ( token ) { var $hintObj = $ ( "<span>" ) . addClass ( "brackets-css-hints" ) ; // highlight the matched portion of each hint if ( token . stringRanges ) { token . stringRanges . forEach ( function ( item ) { if ( item . matched ) { $hintObj . append ( $ ( "<span>" ) . text ( item . text ) . addClass ( "matched-hint" ) ) ; } else { $hintObj . append ( item . text ) ; } } ) ; } else { $hintObj . text ( token . value ) ; } if ( hasColorSwatch ) { $hintObj = ColorUtils . formatColorHint ( $hintObj , token . color ) ; } return $hintObj ; } ) ; }
Returns a sorted and formatted list of hints with the query substring
highlighted.

@param {Array.<Object>} hints - the list of hints to format
@param {string} query - querystring used for highlighting matched
portions of each hint
@return {Array.jQuery} sorted Array of jQuery DOM elements to insert
Returns a sorted and formatted list of hints with the query substring highlighted .