How GitHub Engineers Use GitHub Copilot: 4 Ways

Learn how GitHub Copilot makes GitHub engineers more productive by automating repetitive tasks, staying focused, and more.

Just recently I was developing a new feature for GitHub Copilot chat. My goal was for the chat to be able to recognize the user's project dependencies – this would allow it to give smart answers to the user's questions. I could simply list the project's dependencies and consider the task completed; But I knew that to extract high-quality responses from these large language models, I had to be careful not to overload the prompt or confuse the model by feeding it too much context. This necessitated preliminary processing of the list of dependencies and selection of the most relevant ones for inclusion in the prompt.

It would take days to create machine-processable formats for the most famous frameworks in different programming languages. And at this time I turned to Copilot.

I simply made a request in my IDE's chat:

Look at the selected data structure and create at least 10 examples that match that data structure. The data should cover the most famous frameworks for the Go programming language.

This was my first batch of machine-processable dependencies. In just 30 minutes, I had a complete collection of relevant dependencies for almost all supported languages, complete with parameterized unit tests. This task would have taken days to complete without GitHub Copilot, so half an hour was a great result.

This got me thinking: What good experiences have my colleagues at GitHub had with Copilot? In this short article we will look at several situations in which we use GitHub Copilot.

1. Semi-automation of repetitive tasks

Semi-automation of repetitive tasks is a topic that resonated with a colleague of mine on another team. He said they were tasked with developing and maintaining several live services, many of which use protocol buffers to transfer data. During maintenance, they often encounter a situation where they need to increment ID numbers in protobuf definitions, as shown in the code snippet below:

protobuf

google.protobuf.StringValue fetcher = 130

  [(opts.cts_opt)={src:"Properties" key:"fetcher"}];

google.protobuf.StringValue proxy_enabled = 131

  [(opts.cts_opt)={src:"Properties" key:"proxy_enabled"}];

google.protobuf.StringValue proxy_auth = 132

  [(opts.cts_opt)={src:"Properties" key:"proxy_auth"}];

He especially appreciates the GitHub Editor's Copilot completions for these tasks. This saves a lot of time by eliminating the need to manually generate ID numbers. Instead, you can simply click through the completion suggestions tab until the task is completed.

2. Avoiding distractions

Here's another interesting use case that a colleague told me about. He needed to develop a regular expression to intercept a block of Markdown code and extract the language identifier. Completely immersed in his work, he chose not to interrupt it by switching to chat, although this could provide a solution. Instead, he took a creative approach, formalizing his task in a code comment:

// Приведённая строка содержит блок кода с идентификатором языка.
// Создайте regexp, который соответствует блоку кода и захватывает идентификатор языка.
// Используйте тегированные группы захвата для языка и кода. 

This prompted GitHub Copilot to generate the regular expression as a subsequent statement in the editor:

const re = /“(?\w+)(?[\s\S]+?)``/;

After deleting the comment, the problem was quickly resolved.

3. Structuring notes related to data

One of our technical support engineers shared an incident she and a colleague encountered last week. It was Friday and they were trying to troubleshoot a specific customer. They eventually found a solution by creating various notes in VSCode. And because we prioritize remote collaboration at GitHub, simply solving the problem wasn't enough—we also needed to educate our colleagues about the process to ensure the best experience for future customer requests. Therefore, after completing this complex task, they needed to document how they arrived at the solution.

A colleague launched GitHub Copilot Chat and simply typed something like: “Organize my notes, structure them and collect the data in the editor into Markdown tables.” The task was completed within a matter of seconds, and they went to rest with peace of mind.

4. Study and training

Improving existing skills and acquiring new ones is an integral part of every engineer’s journey. John Berryman, a colleague of mine, decided to use GitHub Copilot to solve a non-trivial coding problem in a completely unfamiliar programming language. His goal was to learn the Rust language, and on Sunday he began this work using the GitHub Copilot chat. The challenge was to develop a program capable of converting any numerical data into its written equivalent in English. Although initially seemingly simple, this task turned out to be fraught with various complexities, such as working with teen numbers, tens naming conventions, placing “and” in the output, and much more.

After 23 minutes and 9 seconds, he successfully created a functional version written in Rust, despite having no experience with the language. Remarkably, he documented the process throughout the work.

Berryman uses an old experimental version of GitHub Copilot to write a program in Rust.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *