Skip to content

fix(#3359): legacy highlight groups will not be overwritten following ColorScheme autocommand - #3360

Merged
alex-courtis merged 1 commit into
nvim-tree:masterfrom
xsbsy-hzbyp:master
Oct 7, 2026
Merged

alex-courtis merged 1 commit into
nvim-tree:masterfrom
xsbsy-hzbyp:master

Conversation

@xsbsy-hzbyp

@xsbsy-hzbyp xsbsy-hzbyp commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

fixes #3359

I have also changed the type of the highlight defaults table to a map for faster lookup.

@alex-courtis alex-courtis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice one, the test case passes on this branch.

Good work identifying the performance issue. Unfortunately, we can't change the default tables to a map: it is defined as a list to preserve the ordering, for :NvimTreeHiTest and similar.

Suggestion:

  • middle loop body is only done when local hl_to = vim.api.nvim_get_hl(0, { name = to }) is defined
  • yes, it would need to be a linear lookup, however it would only be executed when necessary

@xsbsy-hzbyp

Copy link
Copy Markdown
Contributor Author

Yeah, for ~80 items linear lookups are probably better. Should have realized that.

@alex-courtis alex-courtis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Many thanks for your contribution! Tests working as expected.

Comment thread lua/nvim-tree/appearance/init.lua
@alex-courtis alex-courtis changed the title fix(#3359): link to the defined legacy highlight if the new one only links to default fix(#3359): legacy highlight groups will not be overwritten following ColorScheme autocommand Oct 7, 2026
@alex-courtis
alex-courtis merged commit 355bcc8 into nvim-tree:master Oct 7, 2026
4 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.

Auto re-highlight does not respect defined legacy highlight groups if new ones are default-linked.

2 participants