forked from Archives/navigator.lua
79fee5dda8
* multigrid support * Tuning diagnostic performance, add codelens inline hint function * add ctx to error marker handler * setup lsp_signature from navigator * diagnostic refact PR https://github.com/neovim/neovim/pull/15585 * diagnostic api changes * allow disable emoji/nerdfont icons setup * improve diagnostic/codeaction/codelens preview popup; add seperate line * severity_sort set to reverse * prettier for markdown. code action virtual text show title
30 lines
529 B
Lua
30 lines
529 B
Lua
local M = {}
|
|
|
|
function M.debounce_trailing(ms, fn)
|
|
local timer = vim.loop.new_timer()
|
|
return function(...)
|
|
local argv = {...}
|
|
timer:start(ms, 0, function()
|
|
timer:stop()
|
|
fn(unpack(argv))
|
|
end)
|
|
end
|
|
end
|
|
|
|
function M.throttle_leading(ms, fn)
|
|
local timer = vim.loop.new_timer()
|
|
local running = false
|
|
return function(...)
|
|
if not running then
|
|
timer:start(ms, 0, function()
|
|
running = false
|
|
timer:stop()
|
|
end)
|
|
running = true
|
|
fn(...)
|
|
end
|
|
end
|
|
end
|
|
|
|
return M
|