mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-12-22 21:34:54 +01:00
fix: pass callback arg, add available field
This commit is contained in:
parent
32e056de91
commit
2e26df05e2
3 changed files with 6 additions and 3 deletions
|
@ -9,6 +9,7 @@ local function connect()
|
|||
if tmp_cfg.password == nil or #tmp_cfg.password == 0 then
|
||||
tmp_cfg.password = vim.g.codemp_password or vim.fn.input("password > ", "")
|
||||
end
|
||||
print(" -- connecting ...")
|
||||
CODEMP.native.connect(tmp_cfg):and_then(function (client)
|
||||
print(" ++ connected")
|
||||
CODEMP.client = client
|
||||
|
|
|
@ -7,7 +7,7 @@ if CODEMP == nil then
|
|||
---@field rt? RuntimeDriver background codemp runtime
|
||||
---@field client? Client currently connected client
|
||||
---@field workspace? Workspace current active workspace
|
||||
---@field available? WorkspaceReference[] available workspaces to connect to
|
||||
---@field available WorkspaceReference[] available workspaces to connect to
|
||||
---@field timer? any libuv timer
|
||||
---@field config Config codemp configuration
|
||||
---@field setup fun(opts: Config): nil update codemp configuration
|
||||
|
@ -15,6 +15,7 @@ if CODEMP == nil then
|
|||
rt = nil,
|
||||
native = nil,
|
||||
timer = nil,
|
||||
available = {},
|
||||
config = {
|
||||
neo_tree = false,
|
||||
timer_interval = 20,
|
||||
|
@ -58,9 +59,9 @@ if CODEMP.timer == nil then
|
|||
CODEMP.timer = vim.loop.new_timer()
|
||||
CODEMP.timer:start(CODEMP.config.timer_interval, CODEMP.config.timer_interval, function()
|
||||
while true do
|
||||
local cb = CODEMP.native.poll_callback()
|
||||
local cb, arg = CODEMP.native.poll_callback()
|
||||
if cb == nil then break end
|
||||
vim.schedule(function() cb() end)
|
||||
vim.schedule(function() cb(arg) end)
|
||||
end
|
||||
end)
|
||||
|
||||
|
|
|
@ -108,6 +108,7 @@ end
|
|||
---@param workspace string workspace name to join
|
||||
---join a workspace and register event handlers
|
||||
local function join(workspace)
|
||||
print(" <> joining workspace " .. workspace .. " ...")
|
||||
CODEMP.client:join_workspace(workspace):and_then(function (ws)
|
||||
print(" >< joined workspace " .. ws.name)
|
||||
register_cursor_callback(ws)
|
||||
|
|
Loading…
Reference in a new issue