delete_symbol
Deletes a whole function, method, class, or other symbol along with its doc comment and surrounding blank lines, preserving file spacing.
Instructions
Delete a whole function, method, class or other symbol, with its
decorators, a JS/TS export and a C++ template <...> header. The
blank lines that set it apart go too, so the file keeps its spacing. A
symbol that shares a line with other code is cut out of the line. One
name of a declaration of several (int a, b;, struct S {...} s;) is
refused: give replace_function the declaration without it. Refused in
JSON, YAML and TOML files (use delete_key).
Use this when: removing a symbol along with its doc comment. Don't use this when: removing a config key (delete_key), an import (remove_import) or lines inside a body (delete_in_body).
Example: target="LRUCache.old_method"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | Yes | Symbol name as list_symbols lists it, dotted for nesting (e.g. 'LRUCache.old_method', 'A.m(int)'). | |
| file_path | Yes | Absolute path to the source or config file. | |
| include_leading_comments | No | True (default) also deletes the comment block above the symbol, or before it on its first line; false keeps it. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |