Refactoring Code
Refactoring is crucial for enhancing your code's structure and maintainability without altering its behavior. The Pieces for Sublime Text Plugin streamlines this process with Pieces Copilot’s Modify feature.
Modifying Your Code with Pieces Copilot
The Modify function in Pieces Copilot allows you to enhance your selected code by making adjustments such as improving error handling, renaming functions, or adding new functionality.
In Sublime Text, you can modify your code via the following steps:
Via Right-Click Menu
-
Select the portion of code you want to modify.
-
Right-click to open the context menu.
-
Hover over Ask Copilot and select the Modify option.
For example, let’s say you want to add a missing positional argument to the add_user
function. Simply follow these steps, and Pieces Copilot will efficiently apply the necessary changes.
Try using the Modify
function to implement error handling, update deprecated methods, add logging to several functions, or refactor variable names for consistency.