src/language/CSSUtils.js
function _findMatchingRulesInCSSFiles(selector, resultSelectors) {
        var result          = new $.Deferred();

        // Load one CSS file and search its contents
        function _loadFileAndScan(fullPath, selector) {
            var oneFileResult = new $.Deferred();

            DocumentManager.getDocumentForPath(fullPath)
                .done(function (doc) {
                    // Find all matching rules for the given CSS file's content, and add them to the
                    // overall search result
                    var oneCSSFileMatches = _findAllMatchingSelectorsInText(doc.getText(), selector, doc.getLanguage().getMode());
                    _addSelectorsToResults(resultSelectors, oneCSSFileMatches, doc, 0);

                    oneFileResult.resolve();
                })
                .fail(function (error) {
                    console.warn("Unable to read " + fullPath + " during CSS rule search:", error);
                    oneFileResult.resolve();  // still resolve, so the overall result doesn't reject
                });

            return oneFileResult.promise();
        }

        ProjectManager.getAllFiles(ProjectManager.getLanguageFilter(["css", "less", "scss"]))
            .done(function (cssFiles) {
                // Load index of all CSS files; then process each CSS file in turn (see above)
                Async.doInParallel(cssFiles, function (fileInfo, number) {
                    return _loadFileAndScan(fileInfo.fullPath, selector);
                })
                    .then(result.resolve, result.reject);
            });

        return result.promise();
    }
function _findMatchingRulesInCSSFiles(selector, resultSelectors) {
        var result          = new $.Deferred();

        // Load one CSS file and search its contents
        function _loadFileAndScan(fullPath, selector) {
            var oneFileResult = new $.Deferred();

            DocumentManager.getDocumentForPath(fullPath)
                .done(function (doc) {
                    // Find all matching rules for the given CSS file's content, and add them to the
                    // overall search result
                    var oneCSSFileMatches = _findAllMatchingSelectorsInText(doc.getText(), selector, doc.getLanguage().getMode());
                    _addSelectorsToResults(resultSelectors, oneCSSFileMatches, doc, 0);

                    oneFileResult.resolve();
                })
                .fail(function (error) {
                    console.warn("Unable to read " + fullPath + " during CSS rule search:", error);
                    oneFileResult.resolve();  // still resolve, so the overall result doesn't reject
                });

            return oneFileResult.promise();
        }

        ProjectManager.getAllFiles(ProjectManager.getLanguageFilter(["css", "less", "scss"]))
            .done(function (cssFiles) {
                // Load index of all CSS files; then process each CSS file in turn (see above)
                Async.doInParallel(cssFiles, function (fileInfo, number) {
                    return _loadFileAndScan(fileInfo.fullPath, selector);
                })
                    .then(result.resolve, result.reject);
            });

        return result.promise();
    }
function _findMatchingRulesInCSSFiles ( selector , resultSelectors ) { var result = new $ . Deferred ( ) ; // Load one CSS file and search its contents function _loadFileAndScan ( fullPath , selector ) { var oneFileResult = new $ . Deferred ( ) ; DocumentManager . getDocumentForPath ( fullPath ) . done ( function ( doc ) { // Find all matching rules for the given CSS file's content, and add them to the // overall search result var oneCSSFileMatches = _findAllMatchingSelectorsInText ( doc . getText ( ) , selector , doc . getLanguage ( ) . getMode ( ) ) ; _addSelectorsToResults ( resultSelectors , oneCSSFileMatches , doc , 0 ) ; oneFileResult . resolve ( ) ; } ) . fail ( function ( error ) { console . warn ( "Unable to read " + fullPath + " during CSS rule search:" , error ) ; oneFileResult . resolve ( ) ; // still resolve, so the overall result doesn't reject } ) ; return oneFileResult . promise ( ) ; } ProjectManager . getAllFiles ( ProjectManager . getLanguageFilter ( [ "css" , "less" , "scss" ] ) ) . done ( function ( cssFiles ) { // Load index of all CSS files; then process each CSS file in turn (see above) Async . doInParallel ( cssFiles , function ( fileInfo , number ) { return _loadFileAndScan ( fileInfo . fullPath , selector ) ; } ) . then ( result . resolve , result . reject ) ; } ) ; return result . promise ( ) ; }
Finds matching selectors in CSS files; adds them to 'resultSelectors'
Finds matching selectors in CSS files ; adds them to resultSelectors