mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-22 05:14:59 +00:00
fix ruby with ts 0.23
This commit is contained in:
parent
101f7de889
commit
0e65ddee37
2 changed files with 19 additions and 2 deletions
|
@ -249,6 +249,7 @@ class RepoMap:
|
||||||
|
|
||||||
# miss!
|
# miss!
|
||||||
data = list(self.get_tags_raw(fname, rel_fname))
|
data = list(self.get_tags_raw(fname, rel_fname))
|
||||||
|
dump(data)
|
||||||
|
|
||||||
# Update the cache
|
# Update the cache
|
||||||
try:
|
try:
|
||||||
|
@ -287,6 +288,7 @@ class RepoMap:
|
||||||
captures = query.captures(tree.root_node)
|
captures = query.captures(tree.root_node)
|
||||||
|
|
||||||
saw = set()
|
saw = set()
|
||||||
|
dump(USING_TSL_PACK)
|
||||||
if USING_TSL_PACK:
|
if USING_TSL_PACK:
|
||||||
all_nodes = []
|
all_nodes = []
|
||||||
for tag, nodes in captures.items():
|
for tag, nodes in captures.items():
|
||||||
|
@ -295,6 +297,7 @@ class RepoMap:
|
||||||
all_nodes = list(captures)
|
all_nodes = list(captures)
|
||||||
|
|
||||||
for node, tag in all_nodes:
|
for node, tag in all_nodes:
|
||||||
|
dump(node, tag)
|
||||||
if tag.startswith("name.definition."):
|
if tag.startswith("name.definition."):
|
||||||
kind = "def"
|
kind = "def"
|
||||||
elif tag.startswith("name.reference."):
|
elif tag.startswith("name.reference."):
|
||||||
|
@ -311,6 +314,7 @@ class RepoMap:
|
||||||
kind=kind,
|
kind=kind,
|
||||||
line=node.start_point[0],
|
line=node.start_point[0],
|
||||||
)
|
)
|
||||||
|
dump(result)
|
||||||
|
|
||||||
yield result
|
yield result
|
||||||
|
|
||||||
|
@ -407,6 +411,7 @@ class RepoMap:
|
||||||
personalization[rel_fname] = personalize
|
personalization[rel_fname] = personalize
|
||||||
|
|
||||||
tags = list(self.get_tags(fname, rel_fname))
|
tags = list(self.get_tags(fname, rel_fname))
|
||||||
|
dump(tags)
|
||||||
if tags is None:
|
if tags is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -431,11 +436,22 @@ class RepoMap:
|
||||||
|
|
||||||
G = nx.MultiDiGraph()
|
G = nx.MultiDiGraph()
|
||||||
|
|
||||||
|
# Add a small self-edge for every definition that has no references
|
||||||
|
# Helps with tree-sitter 0.23.2 with ruby, where "def greet(name)"
|
||||||
|
# isn't counted as a def AND a ref. tree-sitter 0.24.0 does.
|
||||||
|
for ident in defines.keys():
|
||||||
|
dump(ident)
|
||||||
|
if ident in references:
|
||||||
|
continue
|
||||||
|
for definer in defines[ident]:
|
||||||
|
G.add_edge(definer, definer, weight=0.1, ident=ident)
|
||||||
|
|
||||||
for ident in idents:
|
for ident in idents:
|
||||||
if progress:
|
if progress:
|
||||||
progress()
|
progress()
|
||||||
|
|
||||||
definers = defines[ident]
|
definers = defines[ident]
|
||||||
|
dump(ident, definers)
|
||||||
if ident in mentioned_idents:
|
if ident in mentioned_idents:
|
||||||
mul = 10
|
mul = 10
|
||||||
elif ident.startswith("_"):
|
elif ident.startswith("_"):
|
||||||
|
@ -454,6 +470,7 @@ class RepoMap:
|
||||||
|
|
||||||
G.add_edge(referencer, definer, weight=mul * num_refs, ident=ident)
|
G.add_edge(referencer, definer, weight=mul * num_refs, ident=ident)
|
||||||
|
|
||||||
|
dump(G.nodes)
|
||||||
if not references:
|
if not references:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -291,10 +291,10 @@ class TestRepoMapAllLanguages(unittest.TestCase):
|
||||||
"java": ("java", "Greeting"),
|
"java": ("java", "Greeting"),
|
||||||
"javascript": ("js", "Person"),
|
"javascript": ("js", "Person"),
|
||||||
"kotlin": ("kt", "Greeting"),
|
"kotlin": ("kt", "Greeting"),
|
||||||
"ocaml": ("ml", "Greeter"),
|
# "ocaml": ("ml", "Greeter"), # not supported in tsl-pack (yet?)
|
||||||
"php": ("php", "greet"),
|
"php": ("php", "greet"),
|
||||||
"python": ("py", "Person"),
|
"python": ("py", "Person"),
|
||||||
"ql": ("ql", "greet"),
|
# "ql": ("ql", "greet"), # not supported in tsl-pack (yet?)
|
||||||
"ruby": ("rb", "greet"),
|
"ruby": ("rb", "greet"),
|
||||||
"rust": ("rs", "Person"),
|
"rust": ("rs", "Person"),
|
||||||
"typescript": ("ts", "greet"),
|
"typescript": ("ts", "greet"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue