hlargs.nvim
hlargs.nvim copied to clipboard
Is it possible to only color the current function?
As title.
It's not possible as of now, though I would review the PR if someone's interested in implementing it. It'd mainly involve modifying parse.lua to use a reduced range of search. Also, on CursorMoved you'd have to check if the current function changed, and clear the previous highlighting if that's the case
One thing to take into account is that some languages allow for nested functions. In this case I think what makes the most sense is to apply highlighting for all the parent functions as well, for example in this case, it would apply color to both a
and c
, but not b
:
function a(arg_a){
function b(arg_b){
}
function c(arg_c){
// cursor here
}
}
[...] In this case I think what makes the most sense is to apply highlighting for all the parent functions as well [...]
The same here. Sounds nice to me :) I ask for this mainly because: I don't need to worry about speed on large files anymore.
Fully agree :+1:
Would be nice to have the ability to toggle between the 2 modes (all/only-parent functions)
Yeah, I agree it could be useful. I don't have the time right now to implement it, though I'd merge it if someone does want to do it (if someone does, assign this issue to yourself so that others know you're working on it and we don't duplicate work) Otherwise I'll do it when I find the time, but that may be in a couple of months