@ff-labs/pi-fff 0.10.1 → 0.10.2-nightly.2cf8712
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/aux-finders.ts +3 -4
- package/src/index.ts +9 -3
package/package.json
CHANGED
package/src/aux-finders.ts
CHANGED
|
@@ -14,8 +14,6 @@ interface AuxPicker {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export interface AuxOpts {
|
|
17
|
-
frecencyDbPath?: string;
|
|
18
|
-
historyDbPath?: string;
|
|
19
17
|
enableFsRootScanning: boolean;
|
|
20
18
|
}
|
|
21
19
|
|
|
@@ -69,10 +67,11 @@ export class AuxFinderPool {
|
|
|
69
67
|
}
|
|
70
68
|
|
|
71
69
|
const { FileFinder } = await loadSdk();
|
|
70
|
+
// LMDB env can only be opened once per process; the main finder already
|
|
71
|
+
// owns the frecency/history DBs. Aux finders are transient and run without
|
|
72
|
+
// persistent scoring — see issue #700.
|
|
72
73
|
const result = FileFinder.create({
|
|
73
74
|
basePath: maybeRoot,
|
|
74
|
-
frecencyDbPath: this.opts.frecencyDbPath,
|
|
75
|
-
historyDbPath: this.opts.historyDbPath,
|
|
76
75
|
aiMode: true,
|
|
77
76
|
enableHomeDirScanning: true,
|
|
78
77
|
enableFsRootScanning: this.opts.enableFsRootScanning,
|
package/src/index.ts
CHANGED
|
@@ -344,8 +344,6 @@ export default function fffExtension(pi: ExtensionAPI) {
|
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
let auxPool = new AuxFinderPool({
|
|
347
|
-
frecencyDbPath,
|
|
348
|
-
historyDbPath,
|
|
349
347
|
enableFsRootScanning,
|
|
350
348
|
});
|
|
351
349
|
|
|
@@ -724,7 +722,15 @@ export default function fffExtension(pi: ExtensionAPI) {
|
|
|
724
722
|
|
|
725
723
|
// automatic fuzzy fallback allows to broad the queries and find different cases
|
|
726
724
|
if (result.items.length === 0 && !params.cursor && mode !== "regex") {
|
|
727
|
-
|
|
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, {
|
|
728
734
|
mode: "fuzzy",
|
|
729
735
|
smartCase,
|
|
730
736
|
maxMatchesPerFile: Math.min(effectiveLimit, 50),
|