Skip to content

Commit 5da4281

Browse files
fix(aegis-server): some nested roots don't get registered in index
1 parent 885f4b3 commit 5da4281

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

aegis-core/aegis_core/indexing/project_index.py

+1
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ def remove_associated(self, path: str):
175175
continue
176176

177177
file = pack[resource][removed]
178+
del pack[resource][removed]
178179

179180
mecha = self._ctx.inject(Mecha)
180181
if file in mecha.database:

aegis-server/aegis_server/providers/resource_location.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ def completion(cls, params):
171171

172172
insert_text = (
173173
f"{unresolved[0] + ':' if unresolved[0] else ''}{new_path}"
174-
)
174+
).replace("\\", "/")
175+
175176
if node.is_tag:
176177
insert_text = "#" + insert_text
177178

aegis-server/aegis_server/server/indexing.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ def node_to_types(node: AstNode):
114114
elif len(types) == 1:
115115
return types[0]
116116

117+
# TODO: Fix type unions
118+
return []
117119
return reduce(lambda a, b: a | b, types)
118120

119121

@@ -427,6 +429,8 @@ def call(self, call: AstCall):
427429
def command(self, command: AstCommand):
428430
if not (prototype := self.mecha.spec.prototypes.get(command.identifier)):
429431
return
432+
433+
nested_root_found = False
430434

431435
for i, argument in enumerate(command.arguments):
432436

@@ -471,9 +475,10 @@ def command(self, command: AstCommand):
471475
# Check the command tree for the pattern:
472476
# resource_location, defintion
473477
# which is used by the nested resource plugin to define a new resource
474-
if i + 1 < len(command.arguments) and isinstance(
475-
command.arguments[i + 1], (AstRoot, AstJson)
476-
):
478+
if isinstance(
479+
command.arguments[-1], (AstRoot, AstJson)
480+
) and not nested_root_found:
481+
nested_root_found = True
477482
self.index[file_type].add_definition(
478483
resolved_path,
479484
self.source_path,

0 commit comments

Comments
 (0)