Skip to content

Commit 129b6f7

Browse files
committed
fix(ui): lower priority only for stack preview base highlight
1 parent 065d3bc commit 129b6f7

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

lua/peekstack/ui/stack_view.lua

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ local M = {}
77

88
local NS = vim.api.nvim_create_namespace("PeekstackStackView")
99
local TS_HL_PRIORITY = 150
10+
local PREVIEW_BASE_HL_PRIORITY = 10
1011

1112
---@type table<string, vim.treesitter.Query|false>
1213
local TS_HIGHLIGHT_QUERY_CACHE = {}
@@ -558,9 +559,17 @@ local function render(s)
558559
vim.api.nvim_buf_clear_namespace(s.bufnr, NS, 0, -1)
559560
for line_idx, line_hls in ipairs(highlights) do
560561
for _, hl in ipairs(line_hls) do
561-
vim.api.nvim_buf_set_extmark(s.bufnr, NS, line_idx - 1, hl.col_start, {
562+
local opts = {
562563
end_col = hl.col_end,
563564
hl_group = hl.hl_group,
565+
}
566+
if hl.hl_group == "PeekstackStackViewPreview" then
567+
opts.priority = PREVIEW_BASE_HL_PRIORITY
568+
end
569+
vim.api.nvim_buf_set_extmark(s.bufnr, NS, line_idx - 1, hl.col_start, {
570+
end_col = opts.end_col,
571+
hl_group = opts.hl_group,
572+
priority = opts.priority,
564573
})
565574
end
566575
end

0 commit comments

Comments
 (0)