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

fix(lib/highlight): Ignore invalid highlight keys #18

Merged

Conversation

Frederick888
Copy link
Contributor

If a user sets colour scheme to default after Neovim starts,
nvim_get_hl_by_name('HydraRed', true) returns { [true] = 6 }. This
causes an 'invalid key' error later when it's used in nvim_set_hl().

It is quite a rare case, and it should be fine as long as we can avoid
the error, so that Hydra still functions.


This was anuvyklack/hydra.nvim#75

If a user sets colour scheme to default after Neovim starts,
nvim_get_hl_by_name('HydraRed', true) returns { [true] = 6 }. This
causes an 'invalid key' error later when it's used in nvim_set_hl().

It is quite a rare case, and it should be fine as long as we can avoid
the error, so that Hydra still functions.
@Frederick888 Frederick888 marked this pull request as ready for review December 31, 2023 14:45
@benlubas benlubas self-assigned this Dec 31, 2023
Copy link
Collaborator

@benlubas benlubas left a comment

Choose a reason for hiding this comment

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

could we switch to the new api function nvim_get_hl

lua/hydra/lib/highlight.lua Outdated Show resolved Hide resolved
@benlubas
Copy link
Collaborator

@Frederick888 I'm unable to reproduce the issue as described in the original issue you linked, but I didn't have to do any of the key checks that you had to do (b/c we're using the new api)

Can you make sure that this branch works and then I can go ahead and merge this

@Frederick888
Copy link
Contributor Author

@benlubas Yes, I can confirm this branch works. Thank you.

@benlubas benlubas merged commit ababa9d into nvimtools:main Jan 1, 2024
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.

2 participants