folke / twilight.nvim

🌅 Twilight is a Lua plugin for Neovim 0.5 that dims inactive portions of the code you're editing using TreeSitter.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request] Always highlight entire function when within the function

WizardOfFaraz opened this issue · comments

Great plugin!

Is there a way to always keep the entire function highlighted when within the function?

If yes, is there a way to easily toggle that option without changing my init file and restarting?

I think this is a duplicate of #14 . There's some discussion there how to find the name of the treesitter node to include in the expand table using treesitter playground. TL;DR: what you want is most likely to add "method_definition" in the expand table.

Adding "function_definition" to the expand section works as expected for Python methods.

For those coming here trying to make it work with Rust functions, you are looking for 'function_item' in the expand section.....
You're most welcome ;)

For those who interested for same functionality in Golang just add following lines to expand section in your config:

function_declaration
method_declaration

You can also find this out for other languages here. Just change go keyword in url to your language and you ready to go!

image