This will enable queries like "clangd::" to find symbols under clangd
namespace, without requiring full "clang::clangd::" qualification.
Since Fuzzyfind performs the search under all scopes and only boosts the symbols
from relevant namespaces, we might get symbols from non-matching namespaces.
This patch chooses to drop those as they clearly do not match the query.
I had a little trouble following this...
It seems a little simpler (fewer vars to track) if we avoid the up-front split on scopes.
assert(Scope.empty() || Scope.endswith("::")); // or handle in some way // Walk through Scope, consuming matching tokens from Query. StringRef First; while (!Scope.empty() && !Query.empty()) { tie(First, Scope) = Scope.split("::"); if (Query.front() == First) Query = Query.drop_front(); } return Query.empty(); // all components of query matchedin fact we can avoid preprocessing query too:
// Query is just a StringRef assert(Scope.empty() || Scope.endswith("::")); // or handle in some way assert(Query.empty() || Query.endswith("::")); // Walk through Scope, consuming matching tokens from Query. StringRef First; while (!Scope.empty() && !Query.empty()) { tie(First, Scope) = Scope.split("::"); Query.consume_front(StringRef(First.data(), First.size() + 2) /*Including ::*/); } return Query.empty(); // all components of query matched