Skip to content

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

Merged
benlubas merged 2 commits intonvimtools:mainfrom
Frederick888:ignore-invalid-hl-key-nvimtools
Jan 1, 2024
Merged

fix(lib/highlight): Ignore invalid highlight keys#18
benlubas merged 2 commits intonvimtools:mainfrom
Frederick888:ignore-invalid-hl-key-nvimtools

Conversation

@Frederick888
Copy link
Copy Markdown
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
Copy Markdown
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

@benlubas
Copy link
Copy Markdown
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
Copy Markdown
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