documentation

This commit is contained in:
Barrett Ruth 2026-02-01 22:57:04 -05:00
parent 5d5587b22f
commit d974567a8d
3 changed files with 123 additions and 54 deletions

View file

@ -75,19 +75,28 @@ end
---@param bufnr integer
---@return fun()
local function create_debounced_highlight(bufnr)
---@type uv_timer_t?
local timer = nil
return function()
if timer then
timer:stop() ---@diagnostic disable-line: undefined-field
timer:close() ---@diagnostic disable-line: undefined-field
timer:stop()
timer:close()
timer = nil
end
timer = vim.uv.new_timer()
timer:start(
local t = vim.uv.new_timer()
if not t then
highlight_buffer(bufnr)
return
end
timer = t
t:start(
config.debounce_ms,
0,
vim.schedule_wrap(function()
timer:close()
timer = nil
t:close()
if timer == t then
timer = nil
end
highlight_buffer(bufnr)
end)
)