feat: allow creating workspaces

also connecting to specific server
This commit is contained in:
əlemi 2024-09-06 19:11:18 +02:00
parent 68362f1f08
commit ca3f6f210a
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -56,13 +56,25 @@ M.open = function(state, path, extra)
end
M.add = function(_state)
if session.workspace == nil then error("not in a workspace") end
vim.ui.input({ prompt = "name" }, function(input)
if session.client == nil then
vim.ui.input({ prompt = "server address" }, function(input)
if input == nil or input == "" then return end
client_manager.connect(input)
end)
elseif session.workspace == nil then
vim.ui.input({ prompt = "workspace name" }, function(input)
if input == nil or input == "" then return end
session.client:create_workspace(input):await()
manager.refresh("codemp")
end)
else
vim.ui.input({ prompt = "buffer path" }, function(input)
if input == nil or input == "" then return end
session.workspace:create_buffer(input):await()
manager.refresh("codemp")
end)
end
end
cc._add_common_commands(M)
return M