mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-22 07:24:52 +01:00
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:
parent
1c68e6ec98
commit
6ee3e36a46
1 changed files with 14 additions and 0 deletions
14
src/init.lua
14
src/init.lua
|
@ -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,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue