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
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:
grep -A/grep -B)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