mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-22 07:24:52 +01:00
fix(neotree): now everything sits under codemp title
This commit is contained in:
parent
f5a66f8ba7
commit
134a1b6f00
1 changed files with 14 additions and 15 deletions
|
@ -110,16 +110,14 @@ end
|
||||||
M.update_state = function(state)
|
M.update_state = function(state)
|
||||||
---@type Item[]
|
---@type Item[]
|
||||||
local root = {
|
local root = {
|
||||||
{
|
id = "codemp",
|
||||||
id = "codemp",
|
name = "codemp",
|
||||||
name = "codemp",
|
type = "title",
|
||||||
type = "title",
|
extra = {},
|
||||||
extra = {},
|
children = {},
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if codemp.workspace ~= nil then
|
if codemp.workspace ~= nil then
|
||||||
table.insert(root, spacer())
|
|
||||||
local ws_section = new_root("session #" .. codemp.workspace.name)
|
local ws_section = new_root("session #" .. codemp.workspace.name)
|
||||||
for i, path in ipairs(codemp.workspace:filetree()) do
|
for i, path in ipairs(codemp.workspace:filetree()) do
|
||||||
table.insert(ws_section.children, new_item(codemp.workspace.name, path))
|
table.insert(ws_section.children, new_item(codemp.workspace.name, path))
|
||||||
|
@ -131,30 +129,31 @@ M.update_state = function(state)
|
||||||
end
|
end
|
||||||
table.insert(ws_section.children, spacer())
|
table.insert(ws_section.children, spacer())
|
||||||
table.insert(ws_section.children, usr_section)
|
table.insert(ws_section.children, usr_section)
|
||||||
table.insert(root, ws_section)
|
table.insert(root.children, spacer())
|
||||||
|
table.insert(root.children, ws_section)
|
||||||
end
|
end
|
||||||
|
|
||||||
if codemp.client ~= nil then
|
if codemp.client ~= nil then
|
||||||
table.insert(root, spacer())
|
|
||||||
local ws_section = new_root("workspaces")
|
local ws_section = new_root("workspaces")
|
||||||
for _, ws in ipairs(codemp.available) do
|
for _, ws in ipairs(codemp.available) do
|
||||||
table.insert(ws_section.children, new_workspace(ws.name, ws.owned))
|
table.insert(ws_section.children, new_workspace(ws.name, ws.owned))
|
||||||
end
|
end
|
||||||
table.insert(root, ws_section)
|
table.insert(root.children, spacer())
|
||||||
|
table.insert(root.children, ws_section)
|
||||||
|
|
||||||
table.insert(root, spacer())
|
|
||||||
local status_section = new_root("client")
|
local status_section = new_root("client")
|
||||||
table.insert(status_section.children, new_entry("id", codemp.client.id))
|
table.insert(status_section.children, new_entry("id", codemp.client.id))
|
||||||
table.insert(status_section.children, new_entry("name", codemp.client.username))
|
table.insert(status_section.children, new_entry("name", codemp.client.username))
|
||||||
table.insert(root, status_section)
|
table.insert(root.children, spacer())
|
||||||
|
table.insert(root.children, status_section)
|
||||||
end
|
end
|
||||||
|
|
||||||
if codemp.client == nil then
|
if codemp.client == nil then
|
||||||
table.insert(root, spacer())
|
table.insert(root.children, spacer())
|
||||||
table.insert(root, new_button("[connect]"))
|
table.insert(root.children, new_button("[connect]"))
|
||||||
end
|
end
|
||||||
|
|
||||||
renderer.show_nodes(root, state)
|
renderer.show_nodes({ root }, state)
|
||||||
for _, node in ipairs(state.tree:get_nodes()) do
|
for _, node in ipairs(state.tree:get_nodes()) do
|
||||||
node:expand()
|
node:expand()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue