src/search/node/FindInFilesDomain.js
function fileCrawler() {
    if (!files || (files && files.length === 0)) {
        setTimeout(fileCrawler, 1000);
        return;
    }
    var contents = "";
    if (currentCrawlIndex < files.length) {
        contents = getFileContentsForFile(files[currentCrawlIndex]);
        if (contents) {
            cacheSize += contents.length;
        }
        currentCrawlIndex++;
    }
    if (currentCrawlIndex < files.length) {
        crawlComplete = false;
        setImmediate(fileCrawler);
    } else {
        crawlComplete = true;
        if (!crawlEventSent) {
            crawlEventSent = true;
            _domainManager.emitEvent("FindInFiles", "crawlComplete", [files.length, cacheSize]);
        }
        setTimeout(fileCrawler, 1000);
    }
}
function fileCrawler() {
    if (!files || (files && files.length === 0)) {
        setTimeout(fileCrawler, 1000);
        return;
    }
    var contents = "";
    if (currentCrawlIndex < files.length) {
        contents = getFileContentsForFile(files[currentCrawlIndex]);
        if (contents) {
            cacheSize += contents.length;
        }
        currentCrawlIndex++;
    }
    if (currentCrawlIndex < files.length) {
        crawlComplete = false;
        setImmediate(fileCrawler);
    } else {
        crawlComplete = true;
        if (!crawlEventSent) {
            crawlEventSent = true;
            _domainManager.emitEvent("FindInFiles", "crawlComplete", [files.length, cacheSize]);
        }
        setTimeout(fileCrawler, 1000);
    }
}
function fileCrawler ( ) { if ( ! files || ( files && files . length === 0 ) ) { setTimeout ( fileCrawler , 1000 ) ; return ; } var contents = "" ; if ( currentCrawlIndex < files . length ) { contents = getFileContentsForFile ( files [ currentCrawlIndex ] ) ; if ( contents ) { cacheSize += contents . length ; } currentCrawlIndex ++ ; } if ( currentCrawlIndex < files . length ) { crawlComplete = false ; setImmediate ( fileCrawler ) ; } else { crawlComplete = true ; if ( ! crawlEventSent ) { crawlEventSent = true ; _domainManager . emitEvent ( "FindInFiles" , "crawlComplete" , [ files . length , cacheSize ] ) ; } setTimeout ( fileCrawler , 1000 ) ; } }
Crawls through the files in the project ans stores them in cache. Since that could take a while
we do it in batches so that node wont be blocked.
Crawls through the files in the project ans stores them in cache . Since that could take a while we do it in batches so that node wont be blocked .