DEV Community

Cover image for Getting started with GitHub Copilot in Visual Studio 2022
Emanuele Bartolesi
Emanuele Bartolesi

Posted on

Getting started with GitHub Copilot in Visual Studio 2022

In their blog, GitHub announced the availabity of GitHub Copilot for Visual Studio 2022.

Don't fly solo

GitHub Copilot has launched more or less one year ago and it's been in Technical Preview for a long time.
If you don't have access, join the waiting list.

It's mandatory to use Copilot in Visual Studio 2022, as well.

Visual Studio 2022 Extension

In a very similar way to Visual Studio Code, Visual Studio 2022 has an extension to work with Copilot.

In Visual Studio 2022 go to Extensions **-> Manage Extensions** and search "Copilot"

Download the extension and restart Visual Studio 2022.

Install Copilot

Now you have to authorize Copilot to access your Visual Studio 2022 and when you have restarted the IDE, it opens a new browser window.

Login Copilot

You can directly paste the authorization code in the form and confirm to authorize GitHub Copilot.

Authorize Copilot

If everything is gone with success, you can see a small Copilot logo in the bottom bar of Visual Studio 2022.

Copilot Icon and Settings

How GitHub Copilot works

You don't have to change your actual way to write code or your coding flow.
You can start to type something in the IDE and GitHub Copilot try to suggest what it thinks you are writing.

If you want to accept the suggestion, just hit the tab key on your keybard.
If you want to ignore Copilot for that part of code, just press Esc key.

First of all Copilot try to suggest you the best recommendation from its AI, but if you want to go through all the suggestions, you can use the combination keys "Alt" + ".".
Press "Tab" to accept your favorite suggestion.

In the image below you can see an example directly from my Visual Studio 2022 environment.

Copilot Test

You have another way to get suggestions from GitHub Copilot.
You can start to write a comment like "Create a function to validate email" and it suggests the code for you, below the comment.


GitHub Copilot works very well with JavaScript, TypeScript and Python and the training model for C# is a little bit behind the others.
This is why it's important to start to use it.
It's also important to share the feedback with the Team who works on the service, directly from this link.

Keep coding, not alone.

Top comments (0)