Skip to content

Commit

Permalink
Include subfolders in file search plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverschwendener committed Nov 5, 2018
1 parent c34d4be commit 6b41264
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ describe(FileSearchPlugin.name, (): void => {
const plugin = new FileSearchPlugin(options, testIconSet, emptyBlackList);
const actual = plugin.getAllItems();
const actualLength = actual.length;
const expectedLength = (parentFolders.length * subFolders.length * testFiles.length) + (parentFolders.length * testFiles.length);
const expectedLength = (parentFolders.length * subFolders.length * testFiles.length)
+ (parentFolders.length * testFiles.length)
+ (parentFolders.length * subFolders.length);

expect(actualLength).toBe(expectedLength);
});
Expand Down
3 changes: 2 additions & 1 deletion src/ts/search-plugins/file-search-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ export class FileSearchPlugin implements SearchPlugin {

private loadFilesAndFolders(): SearchResultItem[] {
const result = [] as SearchResultItem[];
const includeFolders = true;

if (this.fileSearchOptions.length > 0) {
for (const option of this.fileSearchOptions) {
const filePaths = option.recursive
? FileHelpers.getFilesFromFolderRecursively(option.folderPath, this.blackList)
? FileHelpers.getFilesFromFolderRecursively(option.folderPath, this.blackList, includeFolders)
: FileHelpers.getFilesFromFolder(option.folderPath);

for (const filePath of filePaths) {
Expand Down

0 comments on commit 6b41264

Please sign in to comment.