mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-12-23 22:04:52 +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 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
|
||||
native.connect(host, username, password):and_then(function (client)
|
||||
session.client = client
|
||||
window.update()
|
||||
print(" ++ connected to " .. host .. " as " .. username)
|
||||
vim.schedule(function () workspace.list(client) end)
|
||||
end)
|
||||
session.client = native.connect(host, username, password):await()
|
||||
window.update()
|
||||
vim.schedule(function () workspace.list() end)
|
||||
end
|
||||
|
||||
return {
|
||||
|
|
|
@ -7,24 +7,22 @@ local user_hl = {}
|
|||
|
||||
local function fetch_workspaces_list()
|
||||
local new_list = {}
|
||||
session.client:list_workspaces(true, false):and_then(function (owned)
|
||||
for _, ws in pairs(owned) do
|
||||
table.insert(new_list, {
|
||||
name = ws,
|
||||
owned = true,
|
||||
})
|
||||
end
|
||||
session.client:list_workspaces(false, true):and_then(function (invited)
|
||||
for _, ws in pairs(invited) do
|
||||
table.insert(new_list, {
|
||||
name = ws,
|
||||
owned = false,
|
||||
})
|
||||
end
|
||||
session.available = new_list
|
||||
window.update()
|
||||
end)
|
||||
end)
|
||||
local owned = session.client:list_workspaces(true, false):await()
|
||||
for _, ws in pairs(owned) do
|
||||
table.insert(new_list, {
|
||||
name = ws,
|
||||
owned = true,
|
||||
})
|
||||
end
|
||||
local invited = session.client:list_workspaces(false, true):await()
|
||||
for _, ws in pairs(invited) do
|
||||
table.insert(new_list, {
|
||||
name = ws,
|
||||
owned = false,
|
||||
})
|
||||
end
|
||||
session.available = new_list
|
||||
window.update()
|
||||
end
|
||||
|
||||
---@param ws Workspace
|
||||
|
|
Loading…
Reference in a new issue