Skip to content

Conversation

@bassamsdata
Copy link

Hello!

This PR introduces a small quality-of-life improvement to the highlight groups. It ensures they are properly reloaded when the colorscheme changes by using the ColorScheme event.

Issue: Blink highlight groups currently become empty when switching colorschemes unless Neovim is restarted.
This change should also help address issue #2199.

This is my first PR here, so please let me know if anything needs to be adjusted or added.

Thank you!

Copilot AI review requested due to automatic review settings November 23, 2025 21:00
Copilot finished reviewing on behalf of bassamsdata November 23, 2025 21:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds automatic reloading of Blink highlight groups when the colorscheme changes by listening to the ColorScheme event. This addresses an issue where highlight groups would become empty after switching colorschemes without restarting Neovim.

Key changes:

  • Refactored highlight setup into a local setup_highlights() function
  • Added a ColorScheme autocmd to reload highlights on theme changes
  • Modified the public highlights.setup() to set up both initial highlights and the autocmd
Comments suppressed due to low confidence (1)

lua/blink/cmp/highlights.lua:11

  • The default = true option prevents highlight groups from being updated when they already exist. When the ColorScheme autocmd triggers setup_highlights(), the highlight groups will already be defined, so they won't be updated with the new colorscheme's values. This defeats the purpose of reloading highlights on colorscheme change. Remove opts.default = true or conditionally set it only on the initial setup.
  local set_hl = function(hl_group, opts)
    opts.default = true -- Prevents overriding existing definitions
    vim.api.nvim_set_hl(0, hl_group, opts)
  end

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

1 participant