works with both tsl and tsl-pack

This commit is contained in:
Paul Gauthier 2025-02-07 16:18:09 -08:00
parent e3d5eaf388
commit 2a56d892d7

View file

@ -285,26 +285,32 @@ class RepoMap:
captures = query.captures(tree.root_node) captures = query.captures(tree.root_node)
saw = set() saw = set()
for tag, nodes in captures.items(): if USING_TSL_PACK:
for node in nodes: all_nodes = []
if tag.startswith("name.definition."): for tag, nodes in captures.items():
kind = "def" all_nodes += [(node, tag) for node in nodes]
elif tag.startswith("name.reference."): else:
kind = "ref" all_nodes = list(captures)
else:
continue
saw.add(kind) for node, tag in all_nodes:
if tag.startswith("name.definition."):
kind = "def"
elif tag.startswith("name.reference."):
kind = "ref"
else:
continue
result = Tag( saw.add(kind)
rel_fname=rel_fname,
fname=fname,
name=node.text.decode("utf-8"),
kind=kind,
line=node.start_point[0],
)
yield result result = Tag(
rel_fname=rel_fname,
fname=fname,
name=node.text.decode("utf-8"),
kind=kind,
line=node.start_point[0],
)
yield result
if "ref" in saw: if "ref" in saw:
return return