fix(picker_ui): highlight fuzzy query matches on file picker#673
Conversation
|
@gustav-fff review I do not undrestand what is wrong here? |
|
[triage-bot] DIRECTED: Old highlighter ( local match_start, match_end = string.find(line_content, ctx.query, 1, true)Plain-text, case-sensitive, whole query as one literal. No fallback. Old code fails to highlight in three cases the PR fixes:
Your screenshot probably shows a single lowercase token that appears as a literal substring in the path — that's the one intersection where old and new produce identical extmarks. Try Caveat worth flagging: the subsequence fallback ( Honk-Honk 🪿 |
|
wait mr @gustav-fff are we not using byte offsets from the fuzzy matcher when rendering the highlights?! |
|
As our friend Gustav said, The change is only for the file picker UI, not the grep picker(your screenshot) It modifies The grep picker (that you showed) has a separate renderer in So this PR fixes fuzzy query highlighting for the file picker list in lua, grep match highlighting already gets its match spans from Rust. |
|
I see sorry yes I'm so dumb today (have a fever) can you please hide this behind a config option and keep it by default disabled Thanks |
|
[triage-bot] DIRECTED: On byte offsets: no, the file picker is not using them. Piping frizbee's On gating: I can't push (cross-repo fork). Inline diff below — adds --- a/lua/fff/conf.lua
+++ b/lua/fff/conf.lua
@@ -414,6 +414,8 @@
-- find_files settings
file_picker = {
current_file_label = '(current)',
+ -- Highlight fuzzy query matches in rendered file rows (experimental; may highlight different characters than the scorer rewarded).
+ highlight_matched_query = false,
},--- a/lua/fff/picker_ui/file_renderer.lua
+++ b/lua/fff/picker_ui/file_renderer.lua
@@ -200,7 +200,8 @@ function M.apply_highlights(item, ctx, item_idx, buf, ns_id, line_idx, line_content)
end
-- 9. Query matches
- if ctx.query and ctx.query ~= '' then
+ local hl_matched_enabled = ctx.config.file_picker and ctx.config.file_picker.highlight_matched_query
+ if hl_matched_enabled and ctx.query and ctx.query ~= '' then
local matched_hl = ctx.config.hl.matched or 'IncSearch'@pompos02 if you're happy with this shape, apply on top of the branch and I'll re-review. README Honk-Honk 🪿 |
Sorry to hear that man, I made the changes and moved this behind a |
Compute fuzzy match byte ranges on the Rust side for paginated file results and pass them through the nvim Lua binding.
|
Hey, File search now computes Notes:
Advise:
|
Brings in upstream 0.10.0 batch: SDK file-watcher exposure (dmtrKovalenko#674), stable FffResult C accessors (dmtrKovalenko#681), pi-fff non-cwd + isomorphic SDK fixes (dmtrKovalenko#622, dmtrKovalenko#669), picker_ui fuzzy-match highlight (dmtrKovalenko#673), README FAQ (dmtrKovalenko#680), vimdoc regen (dmtrKovalenko#683). Conflict resolution: - All crate Cargo.toml + workspace: take ours (0.17.0). Upstream's 0.10.0 is its own independent release line; the fork stays on 0.17.0. fff-mcp keeps its daemon-only deps (fff-ipc/dirs/libc). - fff-core/src/lib.rs: keep BOTH the fork's content_staleness_recheck test module and upstream's new pub watch module (non-overlapping). - install-mcp.sh: keep ours — the fork installs from HEAD/source and points at abhijit-s, so upstream's v0.10.0 release-pinning + SHAs do not apply. - Cargo.lock: ours (no reconciliation needed on build). Verified: build-daemon green; fff-search suite incl. upstream's new watch:: tests + the fork's 4 content_staleness_recheck regressions; daemon crate tests — all 0 failures.

Summary
Improves file picker query highlighting so it better matches fuzzy-search behavior.
Changes
Motivation
Previously, highlighting only searched for the full query as one exact literal string. This meant multi-token queries, case differences, and fuzzy-style matches were often not highlighted making it difficult to see if the match is actually correct (your scoring made it almost always correct)
Performance
Showcase
Before
After