mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-22 15:34:53 +01:00
feat: allow creating workspaces
also connecting to specific server
This commit is contained in:
parent
68362f1f08
commit
ca3f6f210a
1 changed files with 18 additions and 6 deletions
|
@ -56,12 +56,24 @@ M.open = function(state, path, extra)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.add = function(_state)
|
M.add = function(_state)
|
||||||
if session.workspace == nil then error("not in a workspace") end
|
if session.client == nil then
|
||||||
vim.ui.input({ prompt = "name" }, function(input)
|
vim.ui.input({ prompt = "server address" }, function(input)
|
||||||
if input == nil or input == "" then return end
|
if input == nil or input == "" then return end
|
||||||
session.workspace:create_buffer(input):await()
|
client_manager.connect(input)
|
||||||
manager.refresh("codemp")
|
end)
|
||||||
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
|
end
|
||||||
|
|
||||||
cc._add_common_commands(M)
|
cc._add_common_commands(M)
|
||||||
|
|
Loading…
Reference in a new issue