Fix normalizeQuery regex to preserve leading dots in dotfile names

The regex /^[@./]+/ greedily stripped all leading @, ., and / characters,
which caused dotfile queries like '.env' to be normalized to 'env'. This
made searches match too broadly and rank actual dotfiles last.

Changed to /^@?(\.\/)?/ which only strips an optional @ prefix and an
optional ./ path prefix, preserving leading dots that are meaningful
parts of filenames.
This commit is contained in:
Cursor Agent committed 2026-02-17 20:47:15 +00:00
1 parent 798993550b
commit 2e5933cec6
1 file changed
+1 -1
+1 -1
View File
@@ -54,7 +54,7 @@ function basenameOf(input: string): string {
}
function normalizeQuery(input: string): string {
return input.trim().replace(/^[@./]+/, "").toLowerCase();
return input.trim().replace(/^@?(\.\/)?/, "").toLowerCase();
}
function scoreEntry(entry: ProjectEntry, query: string): number {