folke / twilight.nvim

🌅 Twilight is a Lua plugin for Neovim 0.5 that dims inactive portions of the code you're editing using TreeSitter.
Apache License 2.0
1.24k stars 21 forks source link

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

Closed WizardOfFaraz closed 1 month ago

WizardOfFaraz commented 2 years ago

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?

okuuva commented 1 year ago

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.

jluzny commented 1 year ago

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

cmaughan commented 7 months ago

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 ;)

andrew528i commented 5 months ago

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
github-actions[bot] commented 1 month ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 1 month ago

This issue was closed because it has been stalled for 7 days with no activity.