-
Notifications
You must be signed in to change notification settings - Fork 715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ranked match: prefer when each path component matches within a path component #5033
base: master
Are you sure you want to change the base?
Conversation
@@ -52,6 +53,7 @@ private: | |||
StringView m_candidate{}; | |||
bool m_matches = false; | |||
Flags m_flags = Flags::None; | |||
Vector<RankedMatch, MemoryDomain::RankedMatch> m_path_component_matches; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these semantics are okay we could get rid of this allocation by computing the path component matches lazily in RankedMatch::operator<
. I think this could work fine because we use a heap to get the top 100 or so completions, so we never need to sort everything; the number of calls to RankedMatch::operator<
is linear.
I'd need to check.
I broke most of these while working on a rewrite (but the existing tests didn't fail).
…omponent This implements a variant of the approach described in https://nathancraddock.com/blog/2023/a-different-approach-to-fuzzy-finding/#making-filepath-matches-more-accurate
kak_assert(m_path_component_matches.size() == other.m_path_component_matches.size()); | ||
for (auto [lhs, rhs] : zip(m_path_component_matches, other.m_path_component_matches)) | ||
if (*lhs < *rhs) | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably if we use the same recursive-matching for the basename (even if the query contains no slash) then we can make @raiguard's test work:
kak_assert(preferred("luaremote", "src/script/LuaRemote.cpp", "tests/TestLuaRemote.cpp"));
because luaremote
is a prefix (or is it?) of the basename so the RankedMatch will win
f0aadc2
to
e445517
Compare
…omponent This implements a variant of the approach described in https://nathancraddock.com/blog/2023/a-different-approach-to-fuzzy-finding/#making-filepath-matches-more-accurate Equivalent PR: mawww#5033
This implements a variant of the approach described in
https://nathancraddock.com/blog/2023/a-different-approach-to-fuzzy-finding/#making-filepath-matches-more-accurate