mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-22 23:44:55 +01:00
fix: dont use and_then yet
This commit is contained in:
parent
237e3fc619
commit
87dcb03b51
2 changed files with 19 additions and 24 deletions
|
@ -7,12 +7,9 @@ local function connect(host, username, password)
|
||||||
if host == nil then host = 'http://codemp.dev:50053' end
|
if host == nil then host = 'http://codemp.dev:50053' end
|
||||||
if username == nil then username = vim.g.codemp_username or vim.fn.input("username > ", "") end
|
if username == nil then username = vim.g.codemp_username or vim.fn.input("username > ", "") end
|
||||||
if password == nil then password = vim.g.codemp_password or vim.fn.input("password > ", "") end
|
if password == nil then password = vim.g.codemp_password or vim.fn.input("password > ", "") end
|
||||||
native.connect(host, username, password):and_then(function (client)
|
session.client = native.connect(host, username, password):await()
|
||||||
session.client = client
|
|
||||||
window.update()
|
window.update()
|
||||||
print(" ++ connected to " .. host .. " as " .. username)
|
vim.schedule(function () workspace.list() end)
|
||||||
vim.schedule(function () workspace.list(client) end)
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -7,14 +7,14 @@ local user_hl = {}
|
||||||
|
|
||||||
local function fetch_workspaces_list()
|
local function fetch_workspaces_list()
|
||||||
local new_list = {}
|
local new_list = {}
|
||||||
session.client:list_workspaces(true, false):and_then(function (owned)
|
local owned = session.client:list_workspaces(true, false):await()
|
||||||
for _, ws in pairs(owned) do
|
for _, ws in pairs(owned) do
|
||||||
table.insert(new_list, {
|
table.insert(new_list, {
|
||||||
name = ws,
|
name = ws,
|
||||||
owned = true,
|
owned = true,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
session.client:list_workspaces(false, true):and_then(function (invited)
|
local invited = session.client:list_workspaces(false, true):await()
|
||||||
for _, ws in pairs(invited) do
|
for _, ws in pairs(invited) do
|
||||||
table.insert(new_list, {
|
table.insert(new_list, {
|
||||||
name = ws,
|
name = ws,
|
||||||
|
@ -23,8 +23,6 @@ local function fetch_workspaces_list()
|
||||||
end
|
end
|
||||||
session.available = new_list
|
session.available = new_list
|
||||||
window.update()
|
window.update()
|
||||||
end)
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param ws Workspace
|
---@param ws Workspace
|
||||||
|
|
Loading…
Reference in a new issue