Skip to content

Commit d84662e

Browse files
authored
fix(search): preserve meaningful dots (#9951)
If the user searches for `Object.` or `.map`, then the dot is meaningful and shouldn't be merely treated as a word separator.
1 parent 12dde4f commit d84662e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Diff for: client/src/utils.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,13 @@ export function range(start: number, stop: number) {
126126
* Used by quicksearch and sidebar filters.
127127
*/
128128
export function splitQuery(term: string): string[] {
129-
return term
130-
.trim()
131-
.toLowerCase()
132-
.split(/[ ,.]+/);
129+
term = term.trim().toLowerCase();
130+
131+
if (term.startsWith(".") || term.endsWith(".")) {
132+
// Dot is probably meaningful.
133+
return term.split(/[ ,]+/);
134+
} else {
135+
// Dot is probably just a word separator.
136+
return term.split(/[ ,.]+/);
137+
}
133138
}

0 commit comments

Comments
 (0)