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

Improve scope highlight hook #722

Merged
merged 2 commits into from
Oct 11, 2023

Conversation

Danielkonge
Copy link
Contributor

It is not always a good idea to pick the highlight color based on the last symbol of the start/end line when using e.g. rainbow-delimiters. E.g. in Lua, I have some functions that look like this:

...
... function()
  ...
end,

The current code would pick highlights based on the "," (no highlight) and the ")" (wrong highlight, this is one level deeper than function-end).

I have had better luck picking based on the actual scope start/end, and then I have left the old last symbol on the start/end line as a fallback. This picks the color from function and end in the above example.

Copy link
Owner

@lukas-reineke lukas-reineke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks.
Just some suggestions to make the comments clearer.

lua/ibl/hooks.lua Outdated Show resolved Hide resolved
lua/ibl/hooks.lua Outdated Show resolved Hide resolved
Co-authored-by: Lukas Reineke <lukas.reineke@protonmail.com>
@lukas-reineke lukas-reineke merged commit 1bee85e into lukas-reineke:master Oct 11, 2023
7 checks passed
@Danielkonge Danielkonge deleted the hooks-fix branch October 12, 2023 20:19
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

Successfully merging this pull request may close these issues.

None yet

2 participants