Copilot Edits: Edit multiple files and enhance your coding workflow ✨
Get into a true pair programming workflow where Copilot takes on the driver role and you help it navigate changes in your codebase
Introduction
Github Copilot recently introduced the ability to edit multiple files in VS code. As of writing, this feature is currently in preview and titled Edit with Copilot
The possibilities with this capability are immense. You can now pair more efficiently with Copilot and ask it to make changes in your codebase across multiple files in natural language
I took this feature for a spin on the test-infra codebase with a straightforward use case and found the results surprisingly accurate.
In this blog, Let’s take a look at an example workflow step by step and understand how to work with this feature and then also discuss some ideas on how this could be useful in your day-to-day workflows
I use Jetbrains IntelliJ IDEA IDE for most of my professional development, but this capability is not exposed yet on the GitHub plugin there. We’ll use VS code to see this workflow. If you are not familiar with VS code yet you can read this to understand some of the basics
Without further adieu let's dive in 🏊
Launch Edit with Copilot
When you start Copilot edits in VS code you are greeted with this UI. You can add files to your working set. In this case, I have a test file opened which was added by default and we can also add additional files
Another useful feature is that you can switch the model that would be used for code generation under the hood such as Claude 3.5 Sonnet from Anthropic or GPT 4o from Open AI
Describe the change
Copilot edit is more like an experienced pair engineer in the driver role while you adopt the navigator/observer/reviewer role and instruct to perform some edits.
To begin with, You should have a clear idea of what change you want to make in the codebase. Quite often this is the most challenging aspect of working on large codebases because it implies you have a solid understanding of the code structure and what’s happening under the hood.
If you are not sure where the changes need to be made, the results probably won’t be great.
In such cases using chat to figure out higher-level solutions or brainstorming before you jump into edits could be a good way of thinking about this.