Rename a function without renaming a coincidentally-matching string
When to use: You want to rename validateToken → verifyToken and not also rename the docstring that says 'this validates token'.
Flow
-
Find definitionUse tree-sitter MCP. Find the definition of
validateToken— function only, ignore strings and comments.✓ Copied→ AST node with file:line and node type 'function_definition' -
Find referencesFind all call sites of
validateToken— only identifier-resolution matches.✓ Copied→ Reference list, no false positives in strings -
RenameRename to
verifyTokeneverywhere it's a real reference. Show me the diff.✓ Copied→ Diff with N renames in identifier positions only
Outcome: Clean rename that doesn't touch comments, strings, or docs.
Pitfalls
- Dynamic dispatch / reflection misses — Combine with semble for semantic recall on dynamic uses