Feature request: Add tools for moving code
Instead of just reading the symbol information, sometimes it is more desirable to copy a code section than to paste. This is useful for refactoring tasks, which involve copying and pasting code from one file to another or moving a section of code into a function. The main benefits will be a lower chance of the LLM hallucinating the code during code movement.
A side benefit, I suppose, is that it can reduce the number of output tokens, since now a code movement turns from reading and writing the same thing to a single tool call.
Agreed. I think we should add this.
On second thought, a pure copy function is perhaps not the ideal supplement. The typical use cases will be
- to copy & modify (e.g. similar class implementation)
- to copy & delete (i.e. move) & update references.
For the former case, the copy operation is not helpful (as the modifications could directly be inserted by the LLM in a single step). For the latter case, perhaps a dedicated "move" tool would be better.