mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-21 15:04:52 +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
|
if tmp_cfg.password == nil or #tmp_cfg.password == 0 then
|
||||||
tmp_cfg.password = vim.g.codemp_password or vim.fn.input("password > ", "")
|
tmp_cfg.password = vim.g.codemp_password or vim.fn.input("password > ", "")
|
||||||
end
|
end
|
||||||
|
print(" -- connecting ...")
|
||||||
CODEMP.native.connect(tmp_cfg):and_then(function (client)
|
CODEMP.native.connect(tmp_cfg):and_then(function (client)
|
||||||
print(" ++ connected")
|
print(" ++ connected")
|
||||||
CODEMP.client = client
|
CODEMP.client = client
|
||||||
|
|
|
@ -7,7 +7,7 @@ if CODEMP == nil then
|
||||||
---@field rt? RuntimeDriver background codemp runtime
|
---@field rt? RuntimeDriver background codemp runtime
|
||||||
---@field client? Client currently connected client
|
---@field client? Client currently connected client
|
||||||
---@field workspace? Workspace current active workspace
|
---@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 timer? any libuv timer
|
||||||
---@field config Config codemp configuration
|
---@field config Config codemp configuration
|
||||||
---@field setup fun(opts: Config): nil update codemp configuration
|
---@field setup fun(opts: Config): nil update codemp configuration
|
||||||
|
@ -15,6 +15,7 @@ if CODEMP == nil then
|
||||||
rt = nil,
|
rt = nil,
|
||||||
native = nil,
|
native = nil,
|
||||||
timer = nil,
|
timer = nil,
|
||||||
|
available = {},
|
||||||
config = {
|
config = {
|
||||||
neo_tree = false,
|
neo_tree = false,
|
||||||
timer_interval = 20,
|
timer_interval = 20,
|
||||||
|
@ -58,9 +59,9 @@ if CODEMP.timer == nil then
|
||||||
CODEMP.timer = vim.loop.new_timer()
|
CODEMP.timer = vim.loop.new_timer()
|
||||||
CODEMP.timer:start(CODEMP.config.timer_interval, CODEMP.config.timer_interval, function()
|
CODEMP.timer:start(CODEMP.config.timer_interval, CODEMP.config.timer_interval, function()
|
||||||
while true do
|
while true do
|
||||||
local cb = CODEMP.native.poll_callback()
|
local cb, arg = CODEMP.native.poll_callback()
|
||||||
if cb == nil then break end
|
if cb == nil then break end
|
||||||
vim.schedule(function() cb() end)
|
vim.schedule(function() cb(arg) end)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,7 @@ end
|
||||||
---@param workspace string workspace name to join
|
---@param workspace string workspace name to join
|
||||||
---join a workspace and register event handlers
|
---join a workspace and register event handlers
|
||||||
local function join(workspace)
|
local function join(workspace)
|
||||||
|
print(" <> joining workspace " .. workspace .. " ...")
|
||||||
CODEMP.client:join_workspace(workspace):and_then(function (ws)
|
CODEMP.client:join_workspace(workspace):and_then(function (ws)
|
||||||
print(" >< joined workspace " .. ws.name)
|
print(" >< joined workspace " .. ws.name)
|
||||||
register_cursor_callback(ws)
|
register_cursor_callback(ws)
|
||||||
|
|
Loading…
Reference in a new issue