mirror of
https://github.com/neovim/neovim.git
synced 2026-10-25 23:20:23 -05:00
refactor: defer_fn return type #37999
This commit is contained in:
1 parent
61678811d8
commit
ce5c7111f4
3 files changed
+4
-6
No files matched your search
+1
-1
@@ -1285,7 +1285,7 @@ vim.defer_fn({fn}, {timeout}) *vim.defer_fn()*
|
||||
`fn`
|
||||
|
||||
Return: ~
|
||||
(`table`) timer luv timer object
|
||||
(`uv.uv_timer_t`) timer luv timer object
|
||||
|
||||
*vim.deprecate()*
|
||||
vim.deprecate({name}, {alternative}, {version}, {plugin}, {backtrace})
|
||||
|
||||
@@ -513,7 +513,7 @@ end
|
||||
--- safe to call.
|
||||
---@param fn function Callback to call once `timeout` expires
|
||||
---@param timeout integer Number of milliseconds to wait before calling `fn`
|
||||
---@return table timer luv timer object
|
||||
---@return uv.uv_timer_t timer luv timer object
|
||||
function vim.defer_fn(fn, timeout)
|
||||
vim.validate('fn', fn, 'callable', true)
|
||||
|
||||
|
||||
@@ -1141,9 +1141,8 @@ api.nvim_create_autocmd('VimLeavePre', {
|
||||
client:stop(client.exit_timeout)
|
||||
end
|
||||
|
||||
local exit_warning_timer --- @type uv.uv_timer_t?
|
||||
if max_timeout > min_warn_exit_timeout then
|
||||
exit_warning_timer = vim.defer_fn(function()
|
||||
local exit_warning_timer = max_timeout > min_warn_exit_timeout
|
||||
and vim.defer_fn(function()
|
||||
api.nvim_echo({
|
||||
{
|
||||
string.format(
|
||||
@@ -1154,7 +1153,6 @@ api.nvim_create_autocmd('VimLeavePre', {
|
||||
},
|
||||
}, true, {})
|
||||
end, min_warn_exit_timeout)
|
||||
end
|
||||
|
||||
vim.wait(max_timeout, function()
|
||||
return vim.iter(active_clients):all(function(client)
|
||||
|
||||
Reference in new issue
Block a user