Start a free trial
GitHub Copilot provides autocomplete-style suggestions from an AI pair programmer as you code. For more information, see "
About GitHub Copilot Individual
."
If you use a JetBrains IDE, you can view and incorporate suggestions from GitHub Copilot directly within the editor. This guide demonstrates how to use GitHub Copilot within a JetBrains IDE for macOS, Windows, or Linux.
-
To use GitHub Copilot you must have an active GitHub Copilot subscription. For more information, see "
About billing for GitHub Copilot
."
-
To use GitHub Copilot in JetBrains, you must have a compatible JetBrains IDE installed. GitHub Copilot is compatible with the following IDEs:
- IntelliJ IDEA (Ultimate, Community, Educational)
- Android Studio
- AppCode
- CLion
- Code With Me Guest
- DataGrip
- DataSpell
- GoLand
- JetBrains Client
- MPS
- PhpStorm
- PyCharm (Professional, Community, Educational)
- Rider
- RubyMine
- RustRover
- WebStorm
For more information, see the
JetBrains IDEs
tool finder.
To use GitHub Copilot in a JetBrains IDE, you must install the GitHub Copilot extension. The following procedure will guide you through installation of the GitHub Copilot plugin in IntelliJ IDEA. Steps to install the plugin in another supported IDE may differ.
-
In your JetBrains IDE, under the
File
menu for Windows, or under the name of your IDE for Mac (for example,
PyCharm
or
IntelliJ
), click
Settings
.
-
In the left-side menu of the
Settings
dialog box, click
Plugins
.
-
At the top of the
Settings
dialog box, click
Marketplace
. In the search bar, search for
copilot
, then click
Install
.
-
After GitHub Copilot is installed, click
Restart IDE
.
-
After your JetBrains IDE has restarted, click the
Tools
menu. Click
GitHub Copilot
, then click
Login to GitHub
.
-
In the "Sign in to GitHub" dialog box, to copy the device code and open the device activation window, click
Copy and Open
.
-
A device activation window will open in your browser. Paste the device code, then click
Continue
.
-
GitHub will request the necessary permissions for GitHub Copilot. To approve these permissions, click
Authorize GitHub Copilot Plugin
.
-
After the permissions have been approved, your JetBrains IDE will show a confirmation. To begin using GitHub Copilot, click
OK
.
Note:
If you have duplication detection enabled for GitHub Copilot, you may receive limited suggestions, or no suggestions, when using the code examples provided. As an alternative, you can start by typing your own code to see suggestions from GitHub Copilot. For more information on duplication detection, see "
Configuring GitHub Copilot settings on GitHub.com
."
GitHub Copilot provides suggestions for numerous languages and a wide variety of frameworks, but works especially well for Python, JavaScript, TypeScript, Ruby, Go, C# and C++. GitHub Copilot can also assist in query generation for databases. The following samples are in Java, but other languages will work similarly.
-
In your JetBrains IDE, create a new Java (
*.java
) file.
-
In the Java file, create a class by typing
class Test
. GitHub Copilot will automatically suggest a class body in grayed text. The exact suggestion may vary.
-
To accept the suggestion, press
Tab
.
-
To prompt GitHub Copilot to suggest a function body, type the following line below the bracket of the
main
function. The exact suggestion may vary.
Java
private int calculateDaysBetweenDates(Date date1,
private
int
calculateDaysBetweenDates
(Date date1,
-
To accept the suggestion, press
Tab
.
GitHub Copilot will attempt to match the context and style of your code. You can always edit the suggested code.
For any given input, GitHub Copilot may offer multiple suggestions. You can select which suggestion to use, or reject all suggestions.
-
In your JetBrains IDE, create a new Java (
*.java
) file.
-
To prompt GitHub Copilot to show you a suggestion, type the following line in the Java file.
Java
private int calculateDaysBetweenDates(Date date1,
private
int
calculateDaysBetweenDates
(Date date1,
- Optionally, you can see alternative suggestions, if any are available.
OS
| See next suggestion
| See previous suggestion
|
---|
macOS
| Option
+
]
| Option
+
[
|
Windows
| Alt
+
]
| Alt
+
[
|
Linux
| Alt
+
]
| Alt
+
[
|
-
To accept a suggestion, press
Tab
. To reject all suggestions, press
Esc
.
You may not want to accept an entire suggestion from GitHub Copilot. You can use keyboard shortcuts to accept either the next word of a suggestion, or the next line.
-
In your JetBrains IDE, create a new Java (
*.java
) file.
-
To prompt GitHub Copilot to show you a suggestion, type the following line in the Java file.
Java
private int calculateDaysBetweenDates(Date date1,
private
int
calculateDaysBetweenDates
(Date date1,
-
To accept a part of the suggestion, use one of the following keyboard shortcuts.
OS
| Accept Next Word
| Accept Next Line
|
---|
macOS
| Command
+
→
| Command
+
Control
+
→
|
Windows
| Control
+
→
| Control
+
Alt
+
→
|
Linux
| Control
+
→
| Control
+
Alt
+
→
|
-
Alternatively, you can hover over the suggestion to see the GitHub Copilot command palette for choosing suggestions.
You may not want any of the initial suggestions GitHub Copilot offers. You can use a keyboard shortcut to prompt GitHub Copilot to show you multiple suggestions in a new tab.
-
In your JetBrains IDE, create a new Java (
*.java
) file.
-
To prompt GitHub Copilot to show you a suggestion, type the following line in the Java file.
Java
private int calculateDaysBetweenDates(Date date1,
private
int
calculateDaysBetweenDates
(Date date1,
-
Open a new tab with multiple additional suggestions.
- On macOS, press
Command
+
Shift
+
A
, then click
Open GitHub Copilot
, or press
Command
+
Shift
+
\
to open the new tab immediately.
- On Windows or Linux, press
Ctrl
+
Enter
, then click
Open GitHub Copilot
.
-
To accept a suggestion, below the suggestion, click
Accept suggestion NUMBER
. To reject all suggestions, close the tab.
You can describe something you want to do using natural language within a comment, and GitHub Copilot will suggest the code to accomplish your goal.
-
In your JetBrains IDE, create a new Java (
*.java
) file.
-
To prompt GitHub Copilot to suggest an implementation of a function in the Java file, type the following lines.
Java
// find all images without alternate text
// and give them a red border
void process () {
void
process
()
{
You can enable or disable GitHub Copilot for all languages, or for individual languages. The GitHub Copilot status icon in the bottom panel of your JetBrains IDE window indicates whether GitHub Copilot is enabled or disabled. When enabled, the icon is highlighted. When disabled, the icon is grayed out.
-
To enable or disable GitHub Copilot, click the status icon in the bottom panel of the JetBrains window.
-
If you are disabling GitHub Copilot, you will be asked whether you want to disable it globally, or for the language of the file you are currently editing.
- To disable suggestions from GitHub Copilot globally, click
Disable Completions
.
- To disable suggestions from GitHub Copilot for the specified language, click
Disable Completions for
LANGUAGE
.
GitHub Copilot provides autocomplete-style suggestions from an AI pair programmer as you code. For more information, see "
About GitHub Copilot Individual
."
If you use Visual Studio, you can view and incorporate suggestions from GitHub Copilot directly within the editor. This guide demonstrates how to use GitHub Copilot within Visual Studio for Windows.
-
To use GitHub Copilot you must have an active GitHub Copilot subscription. For more information, see "
About billing for GitHub Copilot
."
-
To use GitHub Copilot in Visual Studio, you must have Visual Studio 2022 17.6 or later installed. For more information about using GitHub Copilot Chat in Visual Studio, see the
Visual Studio Copilot Chat
documentation.
Note
: GitHub Copilot is not currently available for use with Visual Studio for Mac.
To use GitHub Copilot, you must first install the GitHub Copilot extension.
For an alternative installation method, you can also use the Microsoft instructions to install the GitHub Copilot extension. For more information, see
Installation instructions
in the Microsoft documentation.
-
In the Visual Studio menu bar, click
Extensions
, then click
Manage Extensions
.
-
In the "Manage Extensions" window, click
Visual Studio Marketplace
, search for the GitHub Copilot extension, then click
Download
.
-
Close the "Manage Extensions" window, then exit and relaunch Visual Studio.
-
Optionally, to check that GitHub Copilot is installed and enabled, go back to
Manage Extensions
, click
Installed
to view your currently installed extensions, then click
GitHub Copilot
to see status information.
-
Open or create a new project in Visual Studio.
-
To enable GitHub Copilot, ensure you have added your GitHub account to Visual Studio. For more information, see
Work with GitHub accounts in Visual Studio
in the Microsoft documentation.
Note:
If you have duplication detection enabled for GitHub Copilot, you may receive limited suggestions, or no suggestions, when using the code examples provided. As an alternative, you can start by typing your own code to see suggestions from GitHub Copilot. For more information on duplication detection, see "
Configuring GitHub Copilot settings on GitHub.com
."
GitHub Copilot provides suggestions for numerous languages and a wide variety of frameworks, but works especially well for Python, JavaScript, TypeScript, Ruby, Go, C# and C++. GitHub Copilot can also assist in query generation for databases. 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 signature. GitHub Copilot will automatically suggest an entire function body in grayed text, as shown below. The exact suggestion may vary.
C#
int CalculateDaysBetweenDates(
int
CalculateDaysBetweenDates
(
-
To accept the suggestion, press
Tab
.
For any given input, GitHub Copilot 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 signature. GitHub Copilot will show you a suggestion.
C#
int CalculateDaysBetweenDates(
int
CalculateDaysBetweenDates
(
-
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 GitHub Copilot command palette for choosing suggestions.
- To accept a suggestion, press
Tab
. To reject all suggestions, press
Esc
.
You can describe something you want to do using natural language within a comment, and GitHub Copilot 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. GitHub Copilot will suggest an implementation of the function.
C#
using System.Xml.Linq;
var doc = XDocument.Load("index.xhml");
// find all images
using
System.Xml.Linq;
var
doc = XDocument.Load(
"index.xhml"
);
-
To accept the suggestion, press
Tab
.
The GitHub Copilot status icon in the bottom panel of the Visual Studio window indicates whether GitHub Copilot 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 GitHub Copilot, click the GitHub Copilot icon in the bottom panel of the Visual Studio window.
-
If you are disabling GitHub Copilot, 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 GitHub Copilot globally, click
Enable Globally
.
- To disable suggestions from GitHub Copilot for the specified language, click
Enable for LANGUAGE
.
GitHub Copilot provides autocomplete-style suggestions from an AI pair programmer as you code. For more information, see "
About GitHub Copilot Individual
."
If you use Visual Studio Code, you can view and incorporate suggestions from GitHub Copilot directly within the editor. This guide demonstrates how to use GitHub Copilot within Visual Studio Code for macOS, Windows, or Linux.
To use GitHub Copilot, you must first install the GitHub Copilot extension.
-
In the Visual Studio Code Marketplace, go to the
GitHub Copilot extension
page and click
Install
.
-
A popup will appear, asking to open Visual Studio Code. Click
Open Visual Studio Code
.
-
In the "Extension: GitHub Copilot" tab in Visual Studio Code, click
Install
.
-
If you have not previously authorized Visual Studio Code in your GitHub account, you will be prompted to sign in to GitHub in Visual Studio Code.
-
If you have previously authorized Visual Studio Code for your account on GitHub, GitHub Copilot will be automatically authorized.
-
If you don't get the prompt to authorize, click the bell icon in the bottom panel of the Visual Studio Code window.
-
In your browser, GitHub will request the necessary permissions for GitHub Copilot. To approve these permissions, click
Authorize Visual Studio Code
.
-
To confirm the authentication, in Visual Studio Code, in the "Visual Studio Code" dialog box, click
Open
.
Note:
If you have duplication detection enabled for GitHub Copilot, you may receive limited suggestions, or no suggestions, when using the code examples provided. As an alternative, you can start by typing your own code to see suggestions from GitHub Copilot. For more information on duplication detection, see "
Configuring GitHub Copilot settings on GitHub.com
."
GitHub Copilot provides suggestions for numerous languages and a wide variety of frameworks, but works especially well for Python, JavaScript, TypeScript, Ruby, Go, C# and C++. GitHub Copilot can also assist in query generation for databases. The following samples are in JavaScript, but other languages will work similarly.
-
In Visual Studio Code, create a new JavaScript (
*.js
) file.
-
In the JavaScript file, type the following function header. GitHub Copilot will automatically suggest an entire function body in grayed text, as shown below. The exact suggestion may vary.
JavaScript
function calculateDaysBetweenDates(begin, end) {
function
calculateDaysBetweenDates
(
begin, end
) {
-
To accept the suggestion, press
Tab
.
Note
: If you don't see a suggestion, make sure GitHub Copilot is enabled. You should see the Copilot icon at the bottom right of the Visual Studio Code window.
If a file has been configured as excluded content for GitHub Copilot, the icon in the status bar will have a diagonal line through it. Hover over the icon to see a tooltip that tells you which settings have applied this restriction.
For more information, see "
Configuring content exclusions for GitHub Copilot
."
For any given input, GitHub Copilot may offer multiple suggestions. You can select which suggestion to use, or reject all suggestions.
-
In Visual Studio Code, create a new JavaScript (
*.js
) file.
-
In the JavaScript file, type the following function header. GitHub Copilot will show you a suggestion.
JavaScript
function calculateDaysBetweenDates(begin, end) {
function
calculateDaysBetweenDates
(
begin, end
) {
-
Optionally, you can see alternative suggestions, if any are available.
OS
| See next suggestion
| See previous suggestion
|
---|
macOS
| Option (?) or Alt
+
]
| Option (?) or Alt
+
[
|
Windows
| Alt
+
]
| Alt
+
[
|
Linux
| Alt
+
]
| Alt
+
[
|
-
Alternatively, you can hover over the suggestion to see the GitHub Copilot command palette for choosing suggestions.
-
To accept a suggestion, press
Tab
. To reject all suggestions, press
Esc
.
You may not want to accept an entire suggestion from GitHub Copilot. You can use keyboard shortcuts to accept either the next word of a suggestion, or the next line.
-
In Visual Studio Code, create a new JavaScript (
*.js
) file.
-
In the JavaScript file, type the following function header. GitHub Copilot will automatically suggest an entire function body in grayed text, as shown below. The exact suggestion may vary.
JavaScript
function calculateDaysBetweenDates(begin, end) {
function
calculateDaysBetweenDates
(
begin, end
) {
-
If you want to accept only the next word of the suggestion, use one of the following keyboard shortcuts.
OS
| Accept Next Word
|
---|
macOS
| Command
+
→
|
Windows
| Control
+
→
|
Linux
| Control
+
→
|
-
If you want to accept the next line of the suggestion, you will need to set a custom keyboard shortcut for the command
editor.action.inlineSuggest.acceptNextLine
. For more information on setting custom keyboard shortcuts, see "
Configuring GitHub Copilot in your environment
."
-
Alternatively, you can hover over the suggestion to see the GitHub Copilot command palette for choosing suggestions.
You may not want any of the initial suggestions GitHub Copilot offers. You can use a keyboard shortcut to prompt GitHub Copilot to show you multiple suggestions in a new tab.
-
In Visual Studio Code, create a new JavaScript (
*.js
) file.
-
In the JavaScript file, type the following function header. GitHub Copilot will show you a suggestion.
JavaScript
function calculateDaysBetweenDates(begin, end) {
function
calculateDaysBetweenDates
(
begin, end
) {
-
To open a new tab with multiple additional options, press
Ctrl
+
Enter
.
-
To accept a suggestion, below the suggestion, click
Accept suggestion NUMBER
. To reject all suggestions, close the tab.
You can describe something you want to do using natural language within a comment, and GitHub Copilot will suggest the code to accomplish your goal.
-
In Visual Studio Code, create a new JavaScript (
*.js
) file.
-
In the JavaScript file, type the following comment. GitHub Copilot will suggest an implementation of the function.
JavaScript
// find all images without alternate text
// and give them a red border
function process() {
function
process
(
) {
You can also use GitHub Copilot to generate suggestions for APIs and frameworks. The following example uses GitHub Copilot to create a simple Express server that returns the current time.
-
In Visual Studio Code, create a new JavaScript (
*.js
) file.
-
In the JavaScript file, type the following comment and then press
Enter
. GitHub Copilot will suggest an implementation of the Express app.
JavaScript
// Express server on port 3000
-
To accept each line, press
Tab
, then
Enter
.
-
Type the following comment and then press
Enter
. GitHub Copilot will suggest an implementation for the default handler.
JavaScript
// Return the current time
-
To accept each line, press
Tab
.
You can enable or disable GitHub Copilot from within Visual Studio Code. The GitHub Copilot status icon in the bottom panel of the Visual Studio Code window indicates whether GitHub Copilot is enabled or disabled. When enabled, the background color of the icon will match the color of the status bar. When disabled, the background color of the icon will contrast with the color of the status bar.
-
To enable or disable GitHub Copilot, click the status icon in the bottom panel of the Visual Studio Code window.
-
If you are disabling GitHub Copilot, 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 GitHub Copilot globally, click
Disable Globally
.
- To disable suggestions from GitHub Copilot for the specified language, click
Disable for LANGUAGE
.
GitHub Copilot provides autocomplete-style suggestions from an AI pair programmer as you code. For more information, see "
About GitHub Copilot Individual
."
If you use Azure Data Studio, you can view and incorporate suggestions from GitHub Copilot directly within the editor. This guide demonstrates how to use GitHub Copilot within Azure Data Studio for macOS, Windows, or Linux.
-
To use GitHub Copilot you must have an active GitHub Copilot subscription. For more information, see "
About billing for GitHub Copilot
."
-
To use GitHub Copilot in Azure Data Studio, you must have Azure Data Studio version 1.44.0 or later installed. For more information, see the
Azure Data Studio download page
in the Azure Data Studio documentation.
To use GitHub Copilot, you must first install the GitHub Copilot extension.
-
In Azure Data Studio, click the
Extensions
icon in the left-side menu.
-
In the "Extensions" tab, search for
GitHub Copilot
and then click
Install
.
-
If a popup window in Azure Data Studio prompts you to sign in to use GitHub Copilot, click
Sign in to GitHub
and follow the instructions on screen.
- If you have previously authorized Azure Data Studio for your account on GitHub, GitHub Copilot will be automatically authorized.
- If you don't get the prompt to authorize, you can view notifications by clicking the bell icon in the bottom panel of the Azure Data Studio window.
-
If you are following the authorization steps, in your browser, GitHub will request the necessary permissions for GitHub Copilot. To approve these permissions, click
Authorize Azure Data Studio
.
Note:
If you have duplication detection enabled for GitHub Copilot, you may receive limited suggestions, or no suggestions, when using the code examples provided. As an alternative, you can start by typing your own code to see suggestions from GitHub Copilot. For more information on duplication detection, see "
Configuring GitHub Copilot settings on GitHub.com
."
GitHub Copilot can provide you with inline suggestions as you create SQL databases in Azure Data Studio. For example, if you're writing a query that joins two tables, Copilot may suggest the join condition from columns in the open editor, other files in the workspace, and common syntax patterns.
-
In Azure Data Studio, create a new SQL file.
-
In the SQL file, type the following query. GitHub Copilot will automatically suggest a join condition in grayed text. The exact suggestion may vary.
SQL
SELECT [UserId], [Red], [Orange], [Yellow], [Green], [Blue], [Purple], [Rainbow]
FROM [Tag].[Scoreboard]
INNER JOIN
SELECT
[UserId], [Red], [Orange], [Yellow], [Green], [Blue], [Purple], [Rainbow]
FROM
[Tag].[Scoreboard]
INNER
JOIN
-
To accept the suggestion, press
Tab
.
For some suggestions, GitHub Copilot may provide multiple alternatives. You can select which suggestion you want to use, or reject all suggestions.
-
In Azure Data Studio, create a new SQL file.
-
In the SQL file, type the following query. GitHub Copilot will show you a suggestion.
SQL
SELECT [UserId], [Red], [Orange], [Yellow], [Green], [Blue], [Purple], [Rainbow]
FROM [Tag].[Scoreboard]
INNER JOIN
SELECT
[UserId], [Red], [Orange], [Yellow], [Green], [Blue], [Purple], [Rainbow]
FROM
[Tag].[Scoreboard]
INNER
JOIN
-
Optionally, you can see alternative suggestions, if any are available.
OS
| See next suggestion
| See previous suggestion
|
---|
Windows
| Alt
+
[
| Alt
+
]
|
Linux
| Alt
+
[
| Alt
+
]
|
macOS
| Option
+
[
| Option
+
]
|
You may not want to accept an entire suggestion from GitHub Copilot. You can use keyboard shortcuts to accept either the next word of a suggestion, or the next line.
-
In Azure Data Studio, create a new SQL file.
-
In the SQL file, type the following query. GitHub Copilot will show you a suggestion.
SQL
SELECT [UserId], [Red], [Orange], [Yellow], [Green], [Blue], [Purple], [Rainbow]
FROM [Tag].[Scoreboard]
INNER JOIN
SELECT
[UserId], [Red], [Orange], [Yellow], [Green], [Blue], [Purple], [Rainbow]
FROM
[Tag].[Scoreboard]
INNER
JOIN
-
If you want to accept only the next word of the suggestion, use one of the following keyboard shortcuts.
OS
| Accept Next Word
|
---|
macOS
| Command
+
→
|
Windows
| Control
+
→
|
Linux
| Control
+
→
|
-
If you want to accept the next line of the suggestion, you will need to set a custom keyboard shortcut for the command
editor.action.inlineSuggest.acceptNextLine
. For more information on setting custom keyboard shortcuts, see "
Keyboard shortcuts in Azure Data Studio
" in the Microsoft documentation.
-
Alternatively, you can hover over the suggestion to see the GitHub Copilot command palette for choosing suggestions.
You can describe something you want to do using natural language within a comment, and GitHub Copilot will suggest the code to accomplish your goal.
-
In Azure Data Studio, create a new SQL file.
-
In the SQL file, type the following query and comment. GitHub Copilot will suggest an implementation of the query.
SQL
SELECT TokenColor, COUNT(UserID) AS UserCount
FROM Tag.Users
GROUP BY TokenColor
-- pivot that query on tokencolor for Purple, Blue, Green, Yellow, Orange, Red
-- and rename the columns to match the colors
SELECT [Purple], [Blue], [Green], [Yellow], [Orange], [Red]
SELECT
TokenColor,
COUNT
(UserID)
AS
UserCount
FROM
Tag.Users
GROUP
BY
TokenColor
SELECT
[Purple], [Blue], [Green], [Yellow], [Orange], [Red]
You can enable or disable GitHub Copilot from within Azure Data Studio. The GitHub Copilot status icon in the bottom panel of the Azure Data Studio window indicates whether GitHub Copilot is enabled or disabled. When enabled, the background color of the icon will match the color of the status bar. When disabled, the background color of the icon will contrast with the color of the status bar.
-
To enable or disable GitHub Copilot, click the status icon in the bottom panel of the Azure Data Studio window.
-
If you are disabling GitHub Copilot, 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 GitHub Copilot globally, click
Disable Globally
.
- To disable suggestions from GitHub Copilot for the specified language, click
Disable for LANGUAGE
.
You successfully installed GitHub Copilot and received your first suggestion, but that's just the beginning! Here are some helpful resources for taking your next steps with GitHub Copilot.