Skip to content

Feature Request: Context lines and definition detection in grep #297

@yashksaini-coder

Description

@yashksaini-coder

So the Rust core already has context lines and definition detection built in for grep, but it's not exposed to Neovim at all. Right now in the FFI layer (crates/fff-nvim/src/lib.rs), everything's just hardcoded to 0 or false, which means we're not taking advantage of features that are already there.

The two things I'm talking about here are:

  • Context Lines - showing a few lines before and after matches (like grep -A / grep -B)
  • Definition Detection - knowing if a match is a function/class/struct definition or just a usage

Would be really nice to have both of these available from Neovim. I've been using the plugin for quite some time, and What I'd like to see is basically expose these through the config and API.

Why I don't want do it in Lua

Doing context extraction in Lua would be slow - that's extra file reads and processing for every single result. Using something like ripgrep instead is possible but then we're not using the stuff that's already been implemented and optimized in the core.

@dmtrKovalenko Would like to hear your thoughts on this

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions