Permalink
Browse files

Fix search for namespaced functions

Summary:
Not actually function-specific, it just appears that way:
A letter in a name is important if it's near the start, or uppercase.

- it's not 'near the start' if it's in a namespace
- classes by convention start with an uppercase character
- functions by convention start with a lowercase character

In practice, this meant that classes generally worked in namespaces, and functions generally didn't.

Fix this by considering 'follows a backslash' to mean 'near the start'

Reviewed By: kmeht

Differential Revision: D8881790

fbshipit-source-id: 1973140bf3e8dcdd6d694fe35192d0aede87a0a8
  • Loading branch information...
fredemmott committed Jul 19, 2018
1 parent c6d872a commit 62a30953b2ffba94f0aeb21a3ee30a71d17e2527
Showing with 1 addition and 0 deletions.
  1. +1 −0 hphp/hack/src/search/fuzzySearchService.ml
@@ -210,6 +210,7 @@ let is_letter_important word idx =
if idx <= 1 then true (* First 2 letters *)
else if Char.uppercase_ascii c = c then true (* Uppercase letter *)
else if String.get word (idx - 1) = '_' then true (* Preceding underscore *)
else if String.get word (idx - 1) = '\\' then true (* Namespaced *)
else false (* Not important *)
(* Indexes up to `max_num` important letters of a word *)

0 comments on commit 62a3095

Please sign in to comment.