replace_leading_comment
Updates or inserts the comment block above a function or class in code files, replacing existing leading comments with new text while maintaining proper syntax structure.
Instructions
Replace the contiguous leading comment block above a named symbol with new_comment. If no leading comment exists, inserts new_comment.
Use this when: You want to update the comment text above a function/class.
Don't use this when: You only want to add a comment where none exists -> use
add_comment_before.
Example: target="LRUCache.get" new_comment=" # Retrieve an item from the cache"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| target | Yes | ||
| new_comment | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |