documentation
This commit is contained in:
parent
5d5587b22f
commit
d974567a8d
3 changed files with 123 additions and 54 deletions
|
|
@ -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)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue