-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathhighlight.lua
More file actions
34 lines (31 loc) · 857 Bytes
/
highlight.lua
File metadata and controls
34 lines (31 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
local M = {
items = {
nsid = vim.api.nvim_create_namespace("java-deps-items"),
highlights = {
LineGuide = { link = "Comment" },
},
},
}
M.init_hl = function()
local ihlf = function(hls)
for name, hl in pairs(hls.highlights) do
if vim.fn.hlexists("JavaDeps" .. name) == 0 then
vim.api.nvim_set_hl(0, "JavaDeps" .. name, { link = hl.link })
end
end
end
ihlf(M.items)
end
M.clear_all_ns = function(bufnr)
vim.api.nvim_buf_clear_namespace(bufnr, -1, 0, -1)
end
---@param bufnr number
---@param hl_info table
---@param nodes TreeItem[]
function M.add_item_highlights(bufnr, hl_info, nodes)
for _, line_hl in ipairs(hl_info) do
local line, hl_start, hl_end, hl_type = unpack(line_hl)
vim.api.nvim_buf_add_highlight(bufnr, M.items.nsid, hl_type, line - 1, hl_start, hl_end)
end
end
return M