About Copiloto de GitHub and Visual Studio
Copiloto de GitHub provides autocomplete-style suggestions from an AI pair programmer as you code. For more information, see "About Copiloto de GitHub".
If you use Visual Studio, you can view and incorporate suggestions from Copiloto de GitHub directly within the editor. This guide demonstrates how to use Copiloto de GitHub within Visual Studio for Windows.
Prerequisites
To use Copiloto de GitHub in Visual Studio, you must have Visual Studio 2022 17.1 or later installed. For more information, see the Visual Studio IDE documentation.
Note: Copiloto de GitHub is not currently available for use with Visual Studio for Mac.
Installing the Visual Studio extension
To use Copiloto de GitHub, you must first install the Visual Studio extension.
-
In the Visual Studio toolbar, click Extensions, then click Manage Extensions.

-
In the "Manage Extensions" window, click Visual Studio Marketplace, search for the Copiloto de GitHub extension, then click Download.

-
Close the "Manage Extensions" window, then exit and relaunch Visual Studio.
-
Optionally, to check that Copiloto de GitHub is installed and enabled, go back to Manage Extensions, click Installed to view your currently installed extensions, then click Copiloto de GitHub to see status information.

-
Open or create a new project in Visual Studio.
-
In the "Microsoft Visual Studio" dialog box, to copy your device activation code, click OK.

-
A device activation window will open in your browser. Paste the device code, then click Continue.
- To paste the code in Windows or Linux, press Ctrl+v.
- To paste the code in macOS, press command+v.
-
GitHub will request the necessary permissions for Copiloto de GitHub. To approve these permissions, click Authorize Copiloto de GitHub Plugin.
-
After you approve the permissions, Visual Studio will show a confirmation.

Seeing your first suggestion
Copiloto de GitHub provides suggestions for numerous languages and a wide variety of frameworks, but works especially well for Python, JavaScript, TypeScript, Ruby, Go, C# and C++. The following samples are in C#, but other languages will work similarly.
- In Visual Studio, create a new C# (*.cs) file.
- In the C# file, type the following function header. Copiloto de GitHub will automatically suggest an entire function body in grayed text, as shown below. The exact suggestion may vary.
C# function calculateDaysBetweenDates(begin, end) {
- To accept the suggestion, press Tab.
Seeing alternative suggestions
For any given input, Copiloto de GitHub may offer multiple suggestions. You can select which suggestion to use, or reject all suggestions.
-
In Visual Studio, create a new C# (*.cs) file.
-
In the C# file, type the following function header. Copiloto de GitHub will show you a suggestion.
C# function calculateDaysBetweenDates(begin, end) { -
If alternative suggestions are available, you can see these alternatives by pressing Alt+] (or Alt+[).
-
Optionally, you can hover over the suggestion to see the Copiloto de GitHub command palette for choosing suggestions.
-
To accept a suggestion, press Tab. To reject all suggestions, press Esc.
Generating code suggestions from comments
You can describe something you want to do using natural language within a comment, and Copiloto de GitHub will suggest the code to accomplish your goal.
-
In Visual Studio, create a new C# (*.cs) file.
-
In the C# file, type the following comment. Copiloto de GitHub will suggest an implementation of the function.
C# using System.Xml.Linq; var doc = XDocument.Load("index.xhml"); // find all images -
To accept the suggestion, press Tab.
Enabling or disabling Copiloto de GitHub
The Copiloto de GitHub status icon in the bottom panel of the Visual Studio window indicates whether Copiloto de GitHub is enabled or disabled. When enabled, the background color of the icon will match the color of the status bar. When disabled, it will have a diagonal line through it.
-
To enable or disable Copiloto de GitHub, click the Copiloto de GitHub icon in the bottom panel of the Visual Studio window.

-
If you are disabling Copiloto de GitHub, you will be asked whether you want to disable suggestions globally, or for the language of the file you are currently editing.
- To disable suggestions from Copiloto de GitHub globally, click Enable Globally.
- To disable suggestions from Copiloto de GitHub for the specified language, click Enable for LANGUAGE.