Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lua/nvim-tree/appearance.lua
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,15 @@ function M.setup()

-- hard link override when legacy only is present
for from, to in pairs(LEGACY_LINKS) do
local hl_from = vim.api.nvim_get_hl(0, { name = from })
local hl_to = vim.api.nvim_get_hl(0, { name = to })
local hl_from
local hl_to
if vim.fn.has "nvim-0.8" == 1 then
Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately we'll have to invert this condition: nvim-0.8 is true when using 0.9

I discovered this as nvim__get_hl_defs has been completely removed from 0.9. So much for non-breaking changes...

hl_from = vim.api.nvim__get_hl_defs(0)[from] or {}
hl_to = vim.api.nvim__get_hl_defs(0)[to] or {}
else
hl_from = vim.api.nvim_get_hl(0, { name = from })
hl_to = vim.api.nvim_get_hl(0, { name = to })
end
if vim.tbl_isempty(hl_from) and not vim.tbl_isempty(hl_to) then
vim.api.nvim_command("hi link " .. from .. " " .. to)
end
Expand Down
10 changes: 9 additions & 1 deletion lua/nvim-tree/renderer/builder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,15 @@ function Builder:create_combined_group(groups)

-- build the highlight, overriding values
for _, group in ipairs(groups) do
local hl = vim.api.nvim_get_hl(0, { name = group, link = false })
local hl
if vim.fn.has "nvim-0.8" == 1 then
hl = vim.api.nvim__get_hl_defs(0)[group] or {}
if hl["link"] then
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This check feels a little overkill considering we default to a table. I'm too much of a lua noob to know for sure.

Copy link
Member

Choose a reason for hiding this comment

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

That's fine; safety first.

hl["link"] = nil
end
else
hl = vim.api.nvim_get_hl(0, { name = group, link = false })
end
combined_hl = vim.tbl_extend("force", combined_hl, hl)
end

Expand Down