forked from OSchip/llvm-project
[clangd] Igore cases in index fuzzy find.
llvm-svn: 321157
This commit is contained in:
parent
700a28a764
commit
125cda7d3b
|
@ -49,7 +49,7 @@ bool MemIndex::fuzzyFind(const Context &Ctx, const FuzzyFindRequest &Req,
|
|||
continue;
|
||||
|
||||
// FIXME(ioeric): use fuzzy matcher.
|
||||
if (StringRef(StringRef(Sym->Name).lower()).contains(Req.Query)) {
|
||||
if (StringRef(Sym->Name).find_lower(Req.Query) != StringRef::npos) {
|
||||
if (++Matched > Req.MaxCandidateCount)
|
||||
return false;
|
||||
Callback(*Sym);
|
||||
|
|
|
@ -178,6 +178,16 @@ TEST(MemIndexTest, NoMatchNestedScopes) {
|
|||
EXPECT_THAT(match(I, Req), UnorderedElementsAre("a::xyz"));
|
||||
}
|
||||
|
||||
TEST(MemIndexTest, IgnoreCases) {
|
||||
MemIndex I;
|
||||
I.build(generateSymbols({"ns::ABC", "ns::abc"}));
|
||||
FuzzyFindRequest Req;
|
||||
Req.Query = "AB";
|
||||
Req.Scopes = {"ns"};
|
||||
auto Matches = match(I, Req);
|
||||
EXPECT_THAT(match(I, Req), UnorderedElementsAre("ns::ABC", "ns::abc"));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace clangd
|
||||
} // namespace clang
|
||||
|
|
Loading…
Reference in New Issue