feat: new callbacks timer

its dirty af because its basically a poller but foreign-thread callbacks
arent safe right now
This commit is contained in:
əlemi 2024-09-01 03:07:14 +02:00
parent 1c68e6ec98
commit 6ee3e36a46
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -43,6 +43,18 @@ vim.api.nvim_create_autocmd(
}
)
local timer_interval = vim.g.codemp_callback_interval or 100
local timer = vim.loop.new_timer()
timer:start(timer_interval, timer_interval, function()
while true do
local cb = native.poll_callback()
if cb == nil then break end
cb()
end
end)
require('codemp.command')
return {
@ -52,5 +64,7 @@ return {
workspace = require('codemp.workspace'),
window = require('codemp.window'),
utils = require('codemp.utils'),
logger = native.logger,
rt = rt,
callbacks_timer = timer,
}