Skip to content

Commit c336325

Browse files
committed
WM LSP Server: put actions in a group
1 parent 6747e39 commit c336325

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

src/finecode/lsp_server/endpoints/action_tree.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def get_project_action_tree(
4242
actions_nodes: list[schemas.ActionTreeNode] = []
4343
if project.status == domain.ProjectStatus.CONFIG_VALID:
4444
assert project.actions is not None
45+
action_nodes: list[schemas.ActionTreeNode] = []
4546
for action in project.actions:
4647
node_id = f"{project.dir_path.as_posix()}::{action.name}"
4748
handlers_nodes = [
@@ -54,7 +55,7 @@ def get_project_action_tree(
5455
)
5556
for handler in action.handlers
5657
]
57-
actions_nodes.append(
58+
action_nodes.append(
5859
schemas.ActionTreeNode(
5960
node_id=node_id,
6061
name=action.name,
@@ -69,7 +70,18 @@ def get_project_action_tree(
6970
action_name=action.name,
7071
)
7172

72-
envs_nodes = []
73+
node_id = f"{project.dir_path.as_posix()}::actions"
74+
actions_nodes.append(
75+
schemas.ActionTreeNode(
76+
node_id=node_id,
77+
name="Actions",
78+
node_type=schemas.ActionTreeNode.NodeType.ACTION_GROUP,
79+
subnodes=action_nodes,
80+
status="",
81+
)
82+
)
83+
84+
envs_nodes: list[schemas.ActionTreeNode] = []
7385
for env in project.envs:
7486
node_id = f"{project.dir_path.as_posix()}::envs::{env}"
7587
envs_nodes.append(

src/finecode/lsp_server/schemas.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ class NodeType(IntEnum):
4444
DIRECTORY = 0
4545
PROJECT = 1
4646
ACTION = 2
47-
PRESET = 3
48-
ENV_GROUP = 4
49-
ENV = 5
47+
ACTION_GROUP = 3
48+
PRESET = 4
49+
ENV_GROUP = 5
50+
ENV = 6
5051

5152

5253
class ListActionsResponse(BaseModel):

0 commit comments

Comments
 (0)