forked from zbirenbaum/copilot.lua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhighlight.lua
More file actions
39 lines (33 loc) · 994 Bytes
/
highlight.lua
File metadata and controls
39 lines (33 loc) · 994 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
35
36
37
38
39
local logger = require("copilot.logger")
local config = require("copilot.config")
local nes_api = require("copilot.nes.api")
local M = {
group = {
CopilotAnnotation = "CopilotAnnotation",
CopilotSuggestion = "CopilotSuggestion",
},
}
local links = {
[M.group.CopilotAnnotation] = "Comment",
[M.group.CopilotSuggestion] = "Comment",
}
function M.setup()
-- Some environments will load themes after plugins (like ChadNv) so we do it as late as possible
vim.schedule(function()
for from_group, to_group in pairs(links) do
local ok, existing = pcall(vim.api.nvim_get_hl, 0, { name = from_group })
if not ok or vim.tbl_isempty(existing) then
vim.api.nvim_set_hl(0, from_group, { link = to_group })
end
end
if config.nes.enabled then
local ok, err = pcall(function()
nes_api.set_hl()
end)
if not ok then
logger.error("Error setting copilot-lsp highlights: ", err)
end
end
end)
end
return M