Skip to content

feat: Highlight and prioritize code definitions in grep results#299

Open
yashksaini-coder wants to merge 6 commits intodmtrKovalenko:mainfrom
yashksaini-coder:feat/context-definition-detection
Open

feat: Highlight and prioritize code definitions in grep results#299
yashksaini-coder wants to merge 6 commits intodmtrKovalenko:mainfrom
yashksaini-coder:feat/context-definition-detection

Conversation

@yashksaini-coder
Copy link
Copy Markdown

Fixes:- #297

This PR adds definition detection to the grep engine.

  • Prioritization: Definitions are now stably sorted to the top of the results.
  • Visuals: Added a [def] indicator highlighted with combo_header to make symbols pop.
  • Config: New classify_definitions toggle added to grep settings (default false).

Kept it focused on definitions only for now to avoid messing with the UI for context lines.

@dmtrKovalenko

Copy link
Copy Markdown
Owner

@dmtrKovalenko dmtrKovalenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution but I think we can make it even better

@yashksaini-coder yashksaini-coder force-pushed the feat/context-definition-detection branch 3 times, most recently from 1606258 to 5f722dc Compare March 19, 2026 12:14
@yashksaini-coder yashksaini-coder force-pushed the feat/context-definition-detection branch from f87e12d to 43331dc Compare March 20, 2026 08:29
@yashksaini-coder
Copy link
Copy Markdown
Author

@dmtrKovalenko can we run the CI/CD checks. I've updated the branch to latest commit

@dmtrKovalenko
Copy link
Copy Markdown
Owner

Thank you. If you don’t mind I’ll push to your PR with some changes I’d like to tune how this feature feels

@yashksaini-coder
Copy link
Copy Markdown
Author

yashksaini-coder commented Mar 21, 2026

Thank you. If you don’t mind I’ll push to your PR with some changes I’d like to tune how this feature feels

Sure why not works for me @dmtrKovalenko Would like to see your approach as well for improving the highlighting in grep

@yashksaini-coder
Copy link
Copy Markdown
Author

Hi @dmtrKovalenko follownig up on my PR, have you made any changes ? also I see some skipped workflows are they manual based for maintainers or reviewers

Copilot AI review requested due to automatic review settings April 7, 2026 08:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR exposes the core grep engine’s definition-classification signal to Neovim and uses it to visually mark definition matches and optionally prioritize them in results, controlled via a new grep.classify_definitions config toggle.

Changes:

  • Added grep.classify_definitions (default false) and threaded it through the Lua → Rust FFI → core grep options.
  • Exposed is_definition on each grep match item to Lua and rendered a [def] indicator in the grep UI.
  • When enabled, core grep post-processes results to prioritize definition matches.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lua/fff/grep/init.lua Passes classify_definitions through to the Rust live_grep FFI call.
lua/fff/grep/grep_renderer.lua Adds virtual-text [def] marker for definition matches.
lua/fff/conf.lua Adds grep.classify_definitions to config typing + defaults.
crates/fff-nvim/src/lua_types.rs Includes is_definition in Lua grep match items.
crates/fff-nvim/src/lib.rs Adds classify_definitions as a new optional live_grep parameter and forwards into GrepSearchOptions.
crates/fff-core/src/grep.rs Sorts matches to prioritize definitions when classification is enabled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yashksaini-coder
Copy link
Copy Markdown
Author

@dmtrKovalenko I have addressed the concerns and issues raised by copilot review, looking forward to your review and feedback, Thanks

@dmtrKovalenko
Copy link
Copy Markdown
Owner

I am sorry brother, I have been working on some additional changes because I really want this feature to shine and jumped away to the random markerting PRs

i will revisit, push some changes and merge this PR in a few days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants