mirror of
https://github.com/adobe/brackets.git
synced 2024-11-20 18:02:54 +01:00
Applied filters, Reverted to sync file reads as its over 5 times faster to index, and reduced indexing startup time to 5 secs
This commit is contained in:
parent
3e5630339a
commit
2d5d22f89b
@ -840,13 +840,17 @@ define(function (require, exports, module) {
|
||||
}
|
||||
ProjectManager.getAllFiles(filter, true, true)
|
||||
.done(function (fileListResult) {
|
||||
var files = fileListResult
|
||||
.filter(function (entry) {
|
||||
return entry.isFile && _isReadableText(entry.fullPath);
|
||||
})
|
||||
.map(function (entry) {
|
||||
return entry.fullPath;
|
||||
});
|
||||
var files = fileListResult,
|
||||
filter = FileFilters.getActiveFilter();
|
||||
if (filter && filter.patterns.length > 0) {
|
||||
filter = new RegExp(FileFilters.compile(filter.patterns));
|
||||
files = files.filter(function (entry) { return !filter.test(entry); });
|
||||
}
|
||||
files = files.filter(function (entry) {
|
||||
return entry.isFile && _isReadableText(entry.fullPath);
|
||||
}).map(function (entry) {
|
||||
return entry.fullPath;
|
||||
});
|
||||
FindUtils.notifyIndexingStarted();
|
||||
searchDomain.exec("initCache", files);
|
||||
});
|
||||
|
@ -347,27 +347,23 @@ maxerr: 50, node: true */
|
||||
setTimeout(fileCrawler, 1000);
|
||||
return;
|
||||
}
|
||||
var contents = "";
|
||||
if (currentCrawlIndex < files.length) {
|
||||
var filePath = files[currentCrawlIndex];
|
||||
fs.readFile(filePath, 'utf8', function (err, data) {
|
||||
if (!err) {
|
||||
projectCache[filePath] = data;
|
||||
cacheSize += data.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);
|
||||
}
|
||||
});
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -685,7 +681,7 @@ maxerr: 50, node: true */
|
||||
}
|
||||
]
|
||||
);
|
||||
setTimeout(fileCrawler, 10000);
|
||||
setTimeout(fileCrawler, 5000);
|
||||
}
|
||||
|
||||
exports.init = init;
|
||||
|
Loading…
Reference in New Issue
Block a user