@ff-labs/pi-fff 0.10.2-nightly.9bab609 → 0.10.2-nightly.edda2cb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.ts +9 -1
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -722,7 +722,15 @@ export default function fffExtension(pi: ExtensionAPI) {
|
|
|
722
722
|
|
|
723
723
|
// automatic fuzzy fallback allows to broad the queries and find different cases
|
|
724
724
|
if (result.items.length === 0 && !params.cursor && mode !== "regex") {
|
|
725
|
-
|
|
725
|
+
// When the caller pinned a specific file (path has an extension), the
|
|
726
|
+
// fuzzy fallback broadens across the whole picker — the file may just
|
|
727
|
+
// be misnamed. For directory constraints (or no path), we keep the
|
|
728
|
+
// constrained query so the fallback does not leak matches from
|
|
729
|
+
// excluded / out-of-scope directories.
|
|
730
|
+
const lastSeg = params.path?.split(/[\\/]/).pop() ?? "";
|
|
731
|
+
const pathTargetsFile = /\.[a-zA-Z][a-zA-Z0-9]{0,9}$/.test(lastSeg);
|
|
732
|
+
const fuzzyQuery = pathTargetsFile ? pattern : query;
|
|
733
|
+
const fuzzy = picker.grep(fuzzyQuery, {
|
|
726
734
|
mode: "fuzzy",
|
|
727
735
|
smartCase,
|
|
728
736
|
maxMatchesPerFile: Math.min(effectiveLimit, 50),
|