Rank daily-note commands (today first) above other link completions - #5
Open
Feel-ix-343 wants to merge 2 commits into
Open
Rank daily-note commands (today first) above other link completions#5Feel-ix-343 wants to merge 2 commits into
Feel-ix-343 wants to merge 2 commits into
Conversation
Co-Authored-By: Felix Zeller <felixazeller@gmail.com>
Co-Authored-By: Felix Zeller <felixazeller@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Typing
[today](todayor[[todayburied thetoday: <date>daily-note command under every heading whose text happens to contain the word "today" — and in a vault with >20 such headings the daily note was dropped entirely, becauserun_completerdoes.take(20)over the matcher's output.Two causes:
sort_textwas the raw fuzzy score as a decimal string, so all equally-scoring items (headings and the daily note all scored 140 in a repro vault) got an identicalsortTextand the client ordered them arbitrarily; and the matcher's output order — which the.take(20)truncation consumes — carried no notion of "this item matters more".Fix: an explicit priority tier, exposed as a defaulted
Matchable::priority()so non-link completables are unaffected:Zero-padding + inverting the score makes plain lexicographic
sortTextordering equal the intended ordering (previously"2"sorted ahead of the better-scoring"21"), and sorting the returned Vec means the.take(20)cut now keeps the daily-note commands instead of cutting them.MDDailyNotenow stores the relative name ("today", "next Monday", …) computed infrom_date/from_referenceableinstead of re-parsingref_nameagainst the configured date format, sopriority()works without completer context;relative_name()became an infallible&straccessor.Verified by driving the server over stdio against a vault with 24 headings containing "today": for both
[today](todayand[[today,today: 2026-08-18is now item #1 with the smallestsortText(04294967155vs24294967155for the headings), where it previously came back 16th. New matcher unit tests cover tier-beats-score and thesortTextlexicographic ordering.Link to Devin session: https://app.devin.ai/sessions/c57ddce975af4dd5ae7861a1f2205307
Requested by: @Feel-ix-343