Skip to content

Commit

Permalink
Case insensitive search (#41)
Browse files Browse the repository at this point in the history
* case insensitive search

* prettier
  • Loading branch information
SantoJambit authored Apr 11, 2021
1 parent e316b4c commit 62380e0
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,20 @@ const lookupRecentItems = (
const recentItemMatchesTerms = (
item: RecentItem,
terms: ReadonlyArray<string> | null
): boolean =>
terms !== null &&
terms.every((t) => item.name.includes(t) || item.readablePath.includes(t));
): boolean => {
if (!terms) {
return false;
} else {
const lowerName = item.name.toLowerCase();
const lowerReadablePath = item.readablePath.toLowerCase();
return terms.every((term) => {
const lowerTerm = term.toLowerCase();
return (
lowerName.includes(lowerTerm) || lowerReadablePath.includes(lowerTerm)
);
});
}
};

/**
* Find all items which match all of the given terms and have a kind contained in `kinds`.
Expand Down

0 comments on commit 62380e0

Please sign in to comment.