Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Review fixes https://github.com/adobe/brackets/pull/4382 #4442

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/project/FileIndexManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,14 @@ define(function (require, exports, module) {
if (!ProjectManager.shouldShow(entry)) {
return;
}

var fileInfo = new FileInfo(entry);

// skip zipped/binary files
if (ProjectManager.isBinaryFile(fileInfo.name)) {
return;
}

//console.log(entry.name);

CollectionUtils.forEach(_indexList, function (index, indexName) {
Expand Down
17 changes: 17 additions & 0 deletions src/project/ProjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ define(function (require, exports, module) {
*/
var _exclusionListRegEx = /\.pyc$|^\.git$|^\.gitignore$|^\.gitmodules$|^\.svn$|^\.DS_Store$|^Thumbs\.db$|^\.hg$|^CVS$|^\.cvsignore$|^\.gitattributes$|^\.hgtags$|^\.hgignore$/;

/**
* @private
* File names which are not showed in quick open dialog
* @type {RegExp}
*/
var _binaryExclusionListRegEx = /\.svgz$|\.jsz$|\.zip$|\.gz$|\.htmz$|\.htmlz$|\.rar$|\.tar$|\.exe$|\.bin$/;

/**
* @private
* Reference to the tree control container div. Initialized by
Expand Down Expand Up @@ -636,6 +643,15 @@ define(function (require, exports, module) {
function shouldShow(entry) {
return !entry.name.match(_exclusionListRegEx);
}

/**
* Returns true if fileName's extension doesn't belong to binary (e.g. archived)
* @param {string} fileName
* @return {boolean}
*/
function isBinaryFile(fileName) {
return fileName.match(_binaryExclusionListRegEx);
}

/**
* @private
Expand Down Expand Up @@ -1553,6 +1569,7 @@ define(function (require, exports, module) {
exports.isWithinProject = isWithinProject;
exports.makeProjectRelativeIfPossible = makeProjectRelativeIfPossible;
exports.shouldShow = shouldShow;
exports.isBinaryFile = isBinaryFile;
exports.openProject = openProject;
exports.getSelectedItem = getSelectedItem;
exports.getInitialProjectPath = getInitialProjectPath;
Expand Down
5 changes: 4 additions & 1 deletion src/search/QuickOpen.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,10 @@ define(function (require, exports, module) {
var filteredList = $.map(fileList, function (fileInfo) {
// Is it a match at all?
// match query against the full path (with gaps between query characters allowed)
var searchResult = matcher.match(ProjectManager.makeProjectRelativeIfPossible(fileInfo.fullPath), query);
var searchResult;

searchResult = matcher.match(ProjectManager.makeProjectRelativeIfPossible(fileInfo.fullPath), query);

if (searchResult) {
searchResult.label = fileInfo.name;
searchResult.fullPath = fileInfo.fullPath;
Expand Down