[refactoring]
Moves a member (method/property/field) from one type to another and updates references.
Try this tool in Playground.
| Name | Type | Required | Description |
|---|---|---|---|
| memberName | string | Yes | Member name to move. |
| sourceTypeName | string | Yes | Source type name. |
| targetTypeName | string | Yes | Target type name. |
| projectName | string | No | Optional project name to limit search. |
| applyChanges | boolean | No | If true (default), applies changes to disk. If false, returns a preview diff. |
| maxReferenceUpdates | number | No | Maximum reference updates when rewriting call sites. Use 0 to disable. Default is 2000. |
| timeout_ms | number | No | Timeout in milliseconds (5 minutes). Use 0 to disable. Default is 300000. |
Move a method to another class
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "move_member",
"arguments": {
"memberName": "ProcessData",
"sourceTypeName": "OldClass",
"targetTypeName": "NewClass"
}
}
}{
"success": true,
"data": {
"symbolName": "MyMethod",
"symbolKind": "Method",
"sourceLocation": "SourceClass",
"targetLocation": "TargetClass",
"filesChanged": 2,
"filesCreated": 0,
"applied": true,
"unifiedDiff": "..."
},
"error": null
}Returns a unified diff of the change set