Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Highlight current block entirely #14

Open
hood opened this issue Aug 7, 2021 · 10 comments
Open

[Feature request] Highlight current block entirely #14

hood opened this issue Aug 7, 2021 · 10 comments

Comments

@hood
Copy link

hood commented Aug 7, 2021

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.

@folke
Copy link
Owner

folke commented Aug 7, 2021

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?

@hood
Copy link
Author

hood commented Aug 9, 2021

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

@folke
Copy link
Owner

folke commented Aug 9, 2021

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.

@hood
Copy link
Author

hood commented Aug 9, 2021

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

screenshot

@folke
Copy link
Owner

folke commented Aug 9, 2021

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

@hood
Copy link
Author

hood commented Aug 9, 2021

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

@hood hood closed this as completed Aug 9, 2021
@vigoux
Copy link

vigoux commented Jan 19, 2022

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 ?

@folke
Copy link
Owner

folke commented Jan 19, 2022

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

@folke folke reopened this Jan 19, 2022
@vigoux
Copy link

vigoux commented Jan 20, 2022

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

@iCraft85
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants