From 6c71f3d86fd45b4f92656fc0deaa560767cce40f Mon Sep 17 00:00:00 2001 From: Santo Pfingsten Date: Fri, 9 Apr 2021 13:30:24 +0200 Subject: [PATCH 1/2] case insensitive search --- extension.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/extension.ts b/extension.ts index a7f0623..4f2b525 100644 --- a/extension.ts +++ b/extension.ts @@ -162,9 +162,18 @@ const lookupRecentItems = ( const recentItemMatchesTerms = ( item: RecentItem, terms: ReadonlyArray | 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`. From 3367c8f08aa94a459ca96799512997d4ff2534a4 Mon Sep 17 00:00:00 2001 From: Santo Pfingsten Date: Fri, 9 Apr 2021 13:43:42 +0200 Subject: [PATCH 2/2] prettier --- extension.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extension.ts b/extension.ts index 4f2b525..9c85641 100644 --- a/extension.ts +++ b/extension.ts @@ -170,10 +170,12 @@ const recentItemMatchesTerms = ( const lowerReadablePath = item.readablePath.toLowerCase(); return terms.every((term) => { const lowerTerm = term.toLowerCase(); - return lowerName.includes(lowerTerm) || lowerReadablePath.includes(lowerTerm); + return ( + lowerName.includes(lowerTerm) || lowerReadablePath.includes(lowerTerm) + ); }); } -} +}; /** * Find all items which match all of the given terms and have a kind contained in `kinds`.