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: resolve links when getting MATCHED_FG highlight #38

Merged
merged 1 commit into from
May 12, 2024

Conversation

bi0ha2ard
Copy link
Contributor

My colorscheme sets WarningMsg as a link, so nvim_get_hl would just return the link object, for which fgwould be nil. This would break all select UIs with an error when nil is passed to string.format.

For reference: The output of nvim_get_hl:

{
  link = "GruvboxRedBold"
}

With this fix, it returns the actual highlight, including the foreground color. That resolves the issue.

@chipsenkbeil
Copy link
Owner

@bi0ha2ard thanks for catching this! One of the areas I lack experience in with neovim plugin development is highlight groups. Should normal_hl and selected_hl also use link = false?

@bi0ha2ard
Copy link
Contributor Author

TBH I jus tlooked at the help and saw that there's an option to follow the link, so I'm not an expert either.

That being said, with link = true you will create { link = "Something, fg = "#abcdef" }. I don't know if that's vaild.

Using link = false will probably do what you wanted, i.e. create a highlight based on the original with replaced colors.

@chipsenkbeil
Copy link
Owner

@bi0ha2ard cool. I'll merge this in and then play around with tweaking the other colors. Thanks again for the find and fix!

@chipsenkbeil chipsenkbeil merged commit 4312f5a into chipsenkbeil:main May 12, 2024
5 checks passed
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