
AI is becoming an integral part of various fields, including software engineering. The close connection between AI and software engineering is not surprising since both fields have similar roots.
AI tools perform at their best when they have access to extensive information and knowledge. In software engineering, developers often use Integrated Development Environments (IDEs) for coding and interacting with AI functionalities.
One way to provide more context within IDEs is by utilizing multi-file editing.
In this post, we will explore the advantages of multi-file editing over single-line editing using test generation with Copilot preview as an example. We will use the diesel open source code, as it is written in Rust (because I like it 😉 ).
The upsert source code folder contains a module on_conflict_extension , which could benefit from additional tests:

Copilot can generate tests for you:

By using multi-file editing in Copilot, you can create tests for all files in the upsert folder.
To achieve this, Copilot needs to have all input files or contextual information in its working set. Drag and drop the files into the Copilot preview pane:

The tests Copilot generates for this working set are much more comprehensive:

Not only can you add multiple files to the Copilot working set, but you can also include additional context, such as symbols, terminal commands, selections, code API, and more:

Screencast
Conclusion
To obtain the best possible AI output, provide as much context and as many files as you can to Copilot. Utilize multi-file editing in Copilot and add extra input, such as symbols, terminal commands, selections, code API, and more to maximize the results Copilot can deliver.
Further reading
- Multi-file editing with different IDEs: https://martinfowler.com/articles/exploring-gen-ai.html#memo-11
- How to generate unit tests with GitHub Copilot: https://github.blog/ai-and-ml/how-to-generate-unit-tests-with-github-copilot-tips-and-examples/
- Multi-file editing preview of Copilot: https://github.blog/changelog/2024-10-29-multi-file-editing-code-review-custom-instructions-and-more-for-github-copilot-in-vs-code-october-release-v0-22/#start-a-code-editing-session-with-multi-file-editing-preview
- ‘Downward Pressure on Code Quality’: https://visualstudiomagazine.com/articles/2024/01/25/copilot-research.aspx
update 2024 12 22
Yesterday, I listened to the podcast episode of https://software-architektur.tv/2024/12/20/episode245.html (German) added the following discussions to my bookmark list:
Leave a Reply