twilight.nvim icon indicating copy to clipboard operation
twilight.nvim copied to clipboard

[Feature request] Highlight current block entirely

Open hood opened this issue 4 years ago • 10 comments

As the title says, it'd be cool to be able to get this plugin to ighlight the whole parent block entirely, instead of highliting the current code block from its start to the current line.

hood avatar Aug 07 '21 15:08 hood

Would be great if you could post a screenshot of the behavior you would like to see, since it's not entirely clear what you're asking :)

I saw you also posted #13 Is that a duplicate of this one?

folke avatar Aug 07 '21 15:08 folke

Yep, #13 is a duplicate of this, I posted twice because I had a submission error thrown at me the first time for some reason.

Here a few screenshots showing the behaviour I'd like to see improved: https://ibb.co/y4JkfB4 <- here only a relative block is highlighted, instead of the entire method I'm in https://ibb.co/P6qRmnd <- here other methods are being highlighted too, instead of only the one I'm in

hood avatar Aug 09 '21 09:08 hood

First of all. This is a buffer that has treesitter enabled right?

Of so, then use the treesitter playground plugin to determine what the scope is of the function (it's not function or method, since we already include those)

Once you know the scope, add it in the expand section of the config.

Would also be great to let me know that scope, since it might be useful to add to the default expand scopes.

folke avatar Aug 09 '21 09:08 folke

This is what I'm seeing using treesitter's playground plugin.

screenshot

hood avatar Aug 09 '21 19:08 hood

You'll probably get what you want by adding method_definition to the expand section of the config. Does that work?

folke avatar Aug 09 '21 20:08 folke

@folke Thanks a lot, man. That worked like a charm!

hood avatar Aug 09 '21 21:08 hood

Reviving this issue: do you think you could use the scope in tree-sitter locals in order to make the dimming ? I think that this would help a lot in the clarity, and make the plugin more predictable in some cases ?

vigoux avatar Jan 19 '22 14:01 vigoux

@vigoux I totally missed the addition of the locals queries! Definitely something I can use to improve Twilight.

folke avatar Jan 19 '22 14:01 folke

It's actually not a really known feature of tree-sitter, but I think you can leverage it 😉 Tell me if I can help in any way, I just started using the plugin, and I really like it so far, great work (again)!

vigoux avatar Jan 20 '22 07:01 vigoux

Hi! I wanted to know if someone could help me with how I can highlight everything inside of the dependencies block thats there in the screenshot?

Screenshot 2023-01-17 at 9 46 29 PM

Looking at the TS Playground in the image, indicates that the value I should use is table_constructor

Screenshot 2023-01-17 at 9 48 42 PM

I tried this but this lead to everything the in outer layer which is also a table_constructor getting highlighted.

Screenshot 2023-01-17 at 9 52 41 PM

I need someway to get it to chose to highlight the inner most block present.

Also on a similar to this, how can I get Twilight to only highlight the lsp.ensure_installed and it's contents

Screenshot 2023-01-17 at 9 54 07 PM

iCraft85 avatar Jan 17 '23 13:01 iCraft85