Supercharge Your Coding: Unlock Multi-File Editing with Copilot for Smarter Test Creation

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

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:

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.