From f38aa63ac4cb83f0ef88d5525d027856cdae07ab Mon Sep 17 00:00:00 2001 From: John Murray Date: Fri, 4 Oct 2024 21:38:50 +0100 Subject: [PATCH] Fix fuzzy match in Explorer tree Find on an ISFS folder in 1.94 (fix #1445) (#1446) --- src/providers/FileSystemProvider/FileSearchProvider.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/providers/FileSystemProvider/FileSearchProvider.ts b/src/providers/FileSystemProvider/FileSearchProvider.ts index 3feece08..39af8260 100644 --- a/src/providers/FileSystemProvider/FileSearchProvider.ts +++ b/src/providers/FileSystemProvider/FileSearchProvider.ts @@ -19,9 +19,12 @@ export class FileSearchProvider implements vscode.FileSearchProvider { let counter = 0; let pattern = query.pattern.charAt(0) == "/" ? query.pattern.slice(1) : query.pattern; - // Drop a leading **/ from the glob pattern if it exists (added by Find widget of Explorer tree, which since 1.94 uses FileSearchProvider) + // Drop a leading **/ from the glob pattern if it exists. This gets added by Find widget of Explorer tree (non-fuzzy mode), which since 1.94 uses FileSearchProvider if (pattern.startsWith("**/")) { pattern = pattern.slice(3); + } else if (pattern.length) { + // Do a fuzzy search + pattern = "*" + pattern.split("").join("*") + "*"; } const params = new URLSearchParams(options.folder.query); const csp = params.has("csp") && ["", "1"].includes(params.get("csp"));