function formatHints(hints, query) {

        var hasMetadata = hints.some(function (token) {
            return token.type || token.description;
        });

        StringMatch.basicMatchSort(hints);
        return hints.map(function (token) {
            var $hintItem = $("<span>").addClass("brackets-pref-hints"),
                $hintObj  = $("<span>").addClass("hint-obj");

            // 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);
            }

            $hintItem.append($hintObj);

            if (hasMetadata) {
                $hintItem.data("type", token.type);
                if (token.description) {
                    $hintItem.append($("<span>")
                                        .addClass("hint-description")
                                        .text(token.description));
                }
            }
            return $hintItem;
        });
    }
function formatHints(hints, query) {

        var hasMetadata = hints.some(function (token) {
            return token.type || token.description;
        });

        StringMatch.basicMatchSort(hints);
        return hints.map(function (token) {
            var $hintItem = $("<span>").addClass("brackets-pref-hints"),
                $hintObj  = $("<span>").addClass("hint-obj");

            // 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);
            }

            $hintItem.append($hintObj);

            if (hasMetadata) {
                $hintItem.data("type", token.type);
                if (token.description) {
                    $hintItem.append($("<span>")
                                        .addClass("hint-description")
                                        .text(token.description));
                }
            }
            return $hintItem;
        });
    }
function formatHints ( hints , query ) { var hasMetadata = hints . some ( function ( token ) { return token . type || token . description ; } ) ; StringMatch . basicMatchSort ( hints ) ; return hints . map ( function ( token ) { var $hintItem = $ ( "<span>" ) . addClass ( "brackets-pref-hints" ) , $hintObj = $ ( "<span>" ) . addClass ( "hint-obj" ) ; // 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 ) ; } $hintItem . append ( $hintObj ) ; if ( hasMetadata ) { $hintItem . data ( "type" , token . type ) ; if ( token . description ) { $hintItem . append ( $ ( "<span>" ) . addClass ( "hint-description" ) . text ( token . description ) ) ; } } return $hintItem ; } ) ; }
/*
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 .
Format hints for the given query