Date: January 9, 2025
Problem: Feature was added to v2, but v2 had file path resolution issues preventing it from finding method definitions.
Solution:
- Simplified the
find_method_definition_standardfunction to use the original workingfind_method_definitionfunction - Removed complex pattern matching that was causing issues
- Fixed path resolution by using the original function's logic
Result: Now working perfectly with AST context display:
================================================================================
AST-ENHANCED METHOD ANALYSIS: 'processData'
================================================================================
📍 METHOD DEFINITIONS FOUND: 1
----------------------------------------
code-intelligence-toolkit/test/TestASTContext.java:14 [TestASTContext(6-42) → processData(14-20)]
public void processData(String orderId) {
Problem: Rope library had environment issues causing crashes when trying to parse the entire project.
Solutions Implemented:
- Made rope optional - it's only used if explicitly requested with
--use-rope - Added proper error handling to fall back to built-in AST if rope fails
- Enhanced built-in AST to handle instance variables (
self.counter) - Added
visit_Attributemethods to track and rename attribute access - Fixed the
argsreference error inperform_ast_rename
Current Status:
- Built-in AST parser now works for basic cases
- Shows AST context correctly:
[SimpleClass(4-10) → __init__(5-6)] - Rope is disabled by default to avoid environment issues
- Some limitations remain with the built-in AST's scope tracking
Result: Functional but with limitations. The tool works for simple renaming tasks but may miss some references in complex scenarios.
Both tools now have functional AST context support:
- method_analyzer_ast.py - Fully fixed and working perfectly
- replace_text_ast.py - Working with built-in AST, rope disabled by default
All 10 tools in the toolkit now support the --ast-context flag, providing valuable hierarchical code structure information in the format [ClassName(lines) → methodName(lines)].