Private
Public Access
0
0

Antigravity is dog shit.

This commit is contained in:
2026-05-20 07:51:58 -04:00
parent 180dc167d2
commit e2305ff49a
15 changed files with 123 additions and 50 deletions
+14 -19
View File
@@ -205,19 +205,11 @@ class ASTParser:
"""
[C: src/mcp_client.py:_search_file, src/mcp_client.py:py_find_usages, src/mcp_client.py:py_get_hierarchy, src/mcp_client.py:trace, src/outline_tool.py:CodeOutliner.outline, src/outline_tool.py:CodeOutliner.walk, src/summarize.py:_summarise_python]
"""
if node.type in ("function_definition", "method_definition", "template_declaration"):
# If template, look for inner function/method
target_node = node
if node.type == "template_declaration":
for child in node.children:
if child.type in ("function_definition", "method_definition"):
target_node = child
break
body = target_node.child_by_field_name("body")
if node.type in ("function_definition", "method_definition"):
body = node.child_by_field_name("body")
if not body:
# C++ fallback: sometimes the body is just a compound_statement without a field name in certain contexts
for child in target_node.children:
for child in node.children:
if child.type in ("compound_statement", "block"):
body = child
break
@@ -232,7 +224,7 @@ class ASTParser:
initializer = None
if self.language_name in ("cpp", "c"):
for child in target_node.children:
for child in node.children:
if child.type == "field_initializer_list":
initializer = child
break
@@ -248,18 +240,19 @@ class ASTParser:
else:
edits.append((start_byte, end_byte, f"\n{indent}..."))
else:
# If there's an initializer list (C++), we strip it too or start from it
start_byte = initializer.start_byte if initializer else body.start_byte
end_byte = body.end_byte
# Try to preserve braces for C-style languages
if body.type == "compound_statement" and len(body.children) >= 2:
if body.children[0].type == "{" and body.children[-1].type == "}":
if body.type == "compound_statement" and len(body.children) >= 2 and body.children[0].type == "{" and body.children[-1].type == "}":
if initializer:
start_byte = initializer.start_byte
end_byte = body.children[-1].start_byte
edits.append((start_byte, end_byte, "{ ... "))
else:
start_byte = body.children[0].end_byte
end_byte = body.children[-1].start_byte
edits.append((start_byte, end_byte, " ... "))
else:
edits.append((start_byte, end_byte, "..."))
else:
edits.append((start_byte, end_byte, "..."))
@@ -754,9 +747,11 @@ class ASTParser:
ntype = node.type
label = ""
if ntype in ("class_definition", "class_specifier"):
label = "[Class]"
has_body = node.child_by_field_name("body") is not None
label = "[Class]" if has_body else "[ClassDecl]"
elif ntype == "struct_specifier":
label = "[Struct]"
has_body = node.child_by_field_name("body") is not None
label = "[Struct]" if has_body else "[StructDecl]"
elif ntype == "function_definition":
label = "[Method]" if indent > 0 else "[Func]"