find_pattern
Search and locate specific nodes in JavaScript or TypeScript code using intuitive syntax. Ideal for pinpointing functions, classes, JSX elements, or debug calls in a codebase.
Instructions
Find first node matching the specified pattern using tree-hugger-js intuitive syntax. Use for targeted searches when you need one specific match.
Examples: • Find main function: find_pattern('function[name="main"]') • Find React component: find_pattern('function[name="UserProfile"]') • Find async functions: find_pattern('function[async]') • Find specific class: find_pattern('class[name="UserManager"]') • Find error handling: find_pattern('call[text*="catch"]') • Find JSX with props: find_pattern('jsx(jsx-attribute[name="className"])') • Debug specific calls: find_pattern('call[text*="console.log"]')
Input Schema
Name | Required | Description | Default |
---|---|---|---|
pattern | Yes | Pattern using intuitive syntax: 'function', 'class[name="MyClass"]', 'function[async]', 'call[text*="fetch"]' |