Insights

5 GitHub Copilot features you might not know about

Written by Matt Thornfield

Discover five lesser-known GitHub Copilot features that can streamline your workflow and unlock hidden capabilities for developers.

A contact recently asked me how widely Generative AI Pair Programming tools, such as GitHub Copilot, are being adopted around the industry. I can only answer that question from the anecdotal evidence that I am seeing, which is that many of our bigger customers are rolling it out in ernest. As a tech training company, we continue to deliver significant amounts of training and workshops on these kinds of tools.

In the early days of wider availability of these tools (Github Copilot was launched in October 2021) there was a natural level of resistance to adoption, with obvious concerns around security, vulnerability, copyright, and so on. Today, it seems that many organizations have satisfied themselves sufficiently to overcome any major concerns they might have had. However we are seeing some resistance to wider adoption and use within parts of the developer community. From time to time I hear experienced developers, who consider themselves to be at the higher levels of proficiency and skill, comment that at least right now, tools such as Copilot do not offer significant value.  

In recent months, as I have personally used Copilot more and more, I’ve begun to disagree with that sentiment. Having written a small application recently almost entirely using GitHub Copilot, I learned that it has some significant strengths and weaknesses. It’s great for generating boilerplate code – in fact for this feature alone I would estimate that my productivity level doubled – I wrote twice the number of lines of code in a week that I would have done without it.

However it definitely doesn’t always get things right, and something that I would have expected it to do perfectly (such as creating a project structure for a common type of application) can fall short of the mark, and need a bit of work and effort to fix.

It’s certainly the case that “you get out what you put in” – the better you become at describing your wants, the better the tool will be at generating a code that can satisfy them.

Along the way, I discovered a few GitHub Copiliot features which I think are useful to know about, and are not things that you might be aware of, especially if the majority of your Copilot experience is gained through experimentation. I’ve listed here my top 5.  Before we get into the detail, a little caveat is that these work in VSCode… sadly they don’t all work with every other IDE.

GitHub Copilot features

1. Drag and drop your problems

You have written some code, and you have a compilation error. You can see the error in your “problems” window of your IDE but you are not sure what to do about it.

GitHub Copilot features


You can right click on the problem line and choose from “Fix using Copilot” or “Explain using Copilot” from the menu.

The feature you might not know about is that you can also click in the middle of this line and drag it into the Copilot chat window. This adds the error as an additional context to your chat, so that it will be considered by the tool in what you then discuss with Copilot.

GitHub Copilot features

2. Fixing the “Generating a markdown file in chat” problem

If you have tried to create a markdown file in Copilot Chat, you may well have come across what I think is a bit of a bug…. Rather than seeing the entire source code that you can insert into your file as a single block, the file starts being rendered, making it impossible to copy or insert it.

GitHub Copilot features

This bug only occurs in the chat window and it’s annoying when it does. There are two ways I found to overcome this problem (and there may well be more).  The first is that you can make the request from outside of the chat window (i.e. use CTRL+I in the file itself to get the context window).

The second alternative is to use Agent mode… and to understand what that is…

3. Ask, edit or agent?

The default mode to interact with Copilot in the chat window is “ask” – this is designed to simulate a conversation… you can ask Copilot questions and it will answer you. However clicking on the little dropdown lets you change the tool into Edit or Agent mode.

GitHub Copilot features



This is a relatively new feature in Copilot – it was only launched in February this year. Edit mode allows you to define tasks for copilot to do, where it will just go and do it directly. If you are in ask mode, Copilot presents you with a potential solution which you can then choose to use, abandon or refine. In edit mode, Copilot just makes the changes directly. You still get the chance to keep or undo the change, but you don’t get the explanations or preview.

GitHub Copilot features

This avoids the problems mentioned in the previous item in this article, but it can also be significantly quicker if you are doing routine tasks that would require edits to multiple files.

Moving to Agent mode takes this a step further – in this mode you can ask Copilot to perform more tasks autonomously.

For example, in agent mode, issuing a command like “create a script to automate building a docker image for this project” might create the Dockerfile, and then a bash or windows bat script that will execute various steps that would be required, such as executing a build tool before building the Docker image.

In agent mode, like in edit mode, you will need to review the changes made after they are generated, rather than as a preview, but this feature certainly sped up some of my actions.

4. Chat can be a two way conversation

The interaction pattern with Copilot is that you ask it to do something and it responds (or actually does it, based on the mode we just discussed). But if Copilot were another human programmer and you asked them to do something, they would likely come back with some questions for clarification. If I say “please can you create me a class to store an Address” they might ask what fields you want to include in that class for example.

The feature I discovered, is that you can tell Copilot to ask you questions in your prompts. For example, using the prompt “create a new entity for a User. Ask me questions to determine what parameters and methods should be in the class, suggesting likely candidates. Ask me one question at a time” will guide you through the creation of the required code.

In this example it asked me which fields I wanted, making some reasonable suggestions, then when I had told it, it asked me if there were going to be any relationships with other classes, and there were a couple of other questions which refined further the requirements.

This process isn’t as good as I would like it to be, but it can be helpful when you are writing code that you haven’t fully designed in your head yet – you can use Copilot to prompt you to think about what you actually want.

5. A picture is worth 100 words

The last item on this list is that you can paste an image into the copilot chat – this is particularly useful if you want to generate a user interface that looks like a pre-existing image. Copilot can analyse your image and work out how to recreate it, extract styling etc.

GitHub Copilot features

If you are working in an environment where a designer has provided you with mockups of what screens should look like, and you need to create an actual User Interface from these images, this should save a significant amount of effort, including thinking time.

Conclusion

By the time you read this blog post, the entries here could be out of date.  Github Copilot is evolving quickly, and there are newer features coming online at regular intervals. But the point of this blog post is to say that it can do more than you probably realised – and it can be a real productivity boost.  It really is revolutionising the way that we write code. The role of the developer is becoming one where we spend more time thinking and less time typing, but producing greater volumes of higher quality code.

Just before finishing this article I had a meeting with a colleague where they told me they had asked Copilot to produce some architecture diagrams for their project, and they were impressed with the results… so I’m off to try that next!

Get in touch

Speak with our team to find out more about our Copilot training

This field is for validation purposes and should be left unchanged.
Share Insight