Symbol.move_to_file(...)
.
Symbol.move_to_file(...)
to move a symbol to a new file.
Symbol.move_to_file(...)
method accepts a strategy
parameter, which can be used to control how imports are updated.
Your options are:
"update_all_imports"
: Updates all import statements across the codebase (default)"add_back_edge"
: Adds import and re-export in the original file"add_back_edge"
is useful when moving a symbol that is depended on by other symbols in the original file, and will result in smaller diffs.
"add_back_edge"
will result in circular dependencies if the symbol has
non-import dependencies in it’s original file.Codebase.commit(...)
after moving symbols in bulk for performant symbol movement.