Merge branch 'copilot-ga-megabranch' into getting-started-articles
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
---
|
||||
title: Getting started with GitHub Copilot in JetBrains
|
||||
shortTitle: JetBrains
|
||||
intro: 'Learn how to install {% data variables.product.prodname_copilot %} in JetBrains, and start seeing suggestions as you write comments and code.'
|
||||
product: '{% data reusables.gated-features.copilot %}'
|
||||
versions:
|
||||
feature: 'copilot'
|
||||
topics:
|
||||
- Copilot
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
{% data reusables.copilot.copilot-prerequisites %}
|
||||
- To use {% data variables.product.prodname_copilot %} in JetBrains, you must have JetBrains IDEs installed. For more information, see the [JetBrains IDEs](https://www.jetbrains.com/idea/download/) documentation.
|
||||
|
||||
## Installing the JetBrains extension
|
||||
|
||||
|
||||
## Seeing your first suggestion
|
||||
|
||||
{% data reusables.copilot.supported-languages %} The following samples are in Java, but other languages will work similarly.
|
||||
|
||||
{% data reusables.copilot.create-java-file %}
|
||||
1. In the Java file, create a class by typing `class Test`.
|
||||
{% data variables.product.prodname_copilot %} will automatically suggest a class body in grayed text, as shown below. The exact suggestion may vary.
|
||||

|
||||
{% data reusables.copilot.accept-suggestion %}
|
||||
1. Below the bracket of the `main` function, type the following function header:
|
||||
```
|
||||
int calculateDaysBetweenDates
|
||||
```
|
||||
{% data variables.product.prodname_copilot %} will automatically suggest a function body in grayed text, as shown below. The exact suggestion may vary.
|
||||

|
||||
{% data reusables.copilot.accept-suggestion %}
|
||||
|
||||
{% data variables.product.prodname_copilot %} will attempt to match your code's context and style. You can edit the suggested code as is necessary.
|
||||
|
||||
## Seeing alternative suggestions
|
||||
|
||||
{% data reusables.copilot.alternative-suggestions %}
|
||||
|
||||
{% data reusables.copilot.create-java-file %}
|
||||
1. In the Java file, type the following:
|
||||
```
|
||||
int calculateDaysBetweenDates(
|
||||
```
|
||||
{% data variables.product.prodname_copilot %} will show you a suggestion.
|
||||
1. To see alternative suggestions:
|
||||
- On macOS, press `Option`+`]` for the next suggestion, or `Option`+`[` for the previous suggestion.
|
||||
- On Windows or Linux, press `Alt`+`]` for the next suggestion, or `Alt`+`[` for the previous suggestion.
|
||||
1. If {% data variables.product.prodname_copilot %} offers a suggestion you want to accept, press `Tab`.
|
||||
1. Alternatively, to reject all suggestions, press `Esc`.
|
||||
|
||||
## Getting more suggestions
|
||||
|
||||
{% data reusables.copilot.suggestions-new-tab %}
|
||||
|
||||
{% data reusables.copilot.create-java-file %}
|
||||
1. In the Java file, type the following:
|
||||
```
|
||||
int calculateDaysBetweenDates(
|
||||
```
|
||||
{% data variables.product.prodname_copilot %} will show you a suggestion.
|
||||
1. To open a new tab with multiple additional options:
|
||||
- On macOS, press `Option`+`Enter`, and select **Open Copilot**.
|
||||
- On Windows or Linux, press `Ctrl`+`Enter`, and select **Open Copilot**.
|
||||

|
||||
{% data variables.product.prodname_copilot %} will open a new tab and suggest multiple options.
|
||||
1. If you want to accept one of the suggestions, above that suggestion, click **Accept Solution**.
|
||||

|
||||
1. Alternatively, to reject all suggestions, close the suggestions tab.
|
||||
|
||||
## Generating code suggestions from comments
|
||||
|
||||
{% data variables.product.prodname_copilot %} can also generate code suggestions from comments.
|
||||
|
||||
{% data reusables.copilot.create-java-file %}
|
||||
1. In the Java file, type the following:
|
||||
```
|
||||
// find all images without alternate text
|
||||
// and give them a red border
|
||||
void process () {
|
||||
```
|
||||
{% data variables.product.prodname_copilot %} will suggest an implementation of the function.
|
||||

|
||||
|
||||
## Enabling and disabling {% data variables.product.prodname_copilot %}
|
||||
|
||||
You can enable or disable {% data variables.product.prodname_copilot %} from within JetBrains. The {% data variables.product.prodname_copilot %} status icon in the bottom panel of the JetBrains window indicates whether {% data variables.product.prodname_copilot %} is enabled or disabled. When enabled, the icon is highlighted. When disabled, the icon is grayed out.
|
||||
|
||||
1. To enable or disable {% data variables.product.prodname_copilot %}, click the status icon in the bottom panel of the JetBrains window.
|
||||

|
||||
2. If you are disabling {% data variables.product.prodname_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 globally, click **Disable Completions**. Alternatively, click the button to disable completions for the language of the file you are currently editing.
|
||||

|
||||
|
||||
|
||||
## Further reading
|
||||
|
||||
- [{% data variables.product.prodname_copilot %}](https://copilot.github.com/)
|
||||
- [About {% data variables.product.prodname_copilot %}](/copilot/overview-of-github-copilot/about-github-copilot)
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
title: Getting started with GitHub Copilot in NeoVim
|
||||
shortTitle: Neovim
|
||||
product: '{% data reusables.gated-features.copilot %}'
|
||||
intro: 'Learn how to install {% data variables.product.prodname_copilot %} in Neovim, and start seeing suggestions as you write comments and code.'
|
||||
versions:
|
||||
feature: 'copilot'
|
||||
topics:
|
||||
- Copilot
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- To use {% data variables.product.prodname_copilot %} in Neovim you must have Neovim and Node.js version 17 or below installed. For more information, see the [Neovim](https://neovim.io/doc/) documentation and the [Node.js](https://nodejs.org/en/) website.
|
||||
|
||||
## Installing the Neovim extension
|
||||
|
||||
{% mac %}
|
||||
|
||||
1. To use {% data variables.product.prodname_copilot %} in Neovim, install the {% data variables.product.prodname_copilot %} plugin:
|
||||
- You can install `github/copilot.vim` with a plugin manager, such as vim-plug or packer.nvim. For more information, see the [vim plug]() documentation, or the [packer.nvim]() documentation.
|
||||
- Alternatively, you can install the {% data variables.product.prodname_copilot %} plugin directly into your Neovim config file by running the following command in Terminal:
|
||||
|
||||
```
|
||||
git clone https://github.com/github/copilot.vim.git \
|
||||
~/.config/PATH/TO/YOUR/NEOVIM/CONFIG/FILE/copilot.vim
|
||||
```
|
||||
1. To authenticate and invoke {% data variables.product.prodname_copilot %} run the following command in Neovim:
|
||||
|
||||
```
|
||||
:Copilot setup
|
||||
```
|
||||
|
||||
{% endmac %}
|
||||
|
||||
|
||||
{% windows %}
|
||||
|
||||
1. To use {% data variables.product.prodname_copilot %} in Neovim, install the {% data variables.product.prodname_copilot %} plugin:
|
||||
- You can install `github/copilot.vim` with a plugin manager, such as vim-plug or packer.nvim. For more information, see the [vim-plug](https://github.com/junegunn/vim-plug) documentation, or the [packer.nvim](https://github.com/wbthomason/packer.nvim) documentation.
|
||||
- Alternatively, you can install the {% data variables.product.prodname_copilot %} plugin directly into your Neovim config file by running the following command in Git Bash:
|
||||
|
||||
```
|
||||
git clone https://github.com/github/copilot.vim.git \
|
||||
~/.config/PATH/TO/YOUR/NEOVIM/CONFIG/FILE/copilot.vim
|
||||
1. To authenticate and invoke {% data variables.product.prodname_copilot %} run the following command in Neovim:
|
||||
|
||||
```
|
||||
:Copilot setup
|
||||
```
|
||||
```
|
||||
|
||||
{% endwindows %}
|
||||
|
||||
|
||||
{% linux %}
|
||||
|
||||
1. To use {% data variables.product.prodname_copilot %} in Neovim, install the {% data variables.product.prodname_copilot %} plugin:
|
||||
- You can install `github/copilot.vim` with a plugin manager, such as vim-plug or packer.nvim. For more information, see the [vim plug]() documentation, or the [packer.nvim]() documentation.
|
||||
- Alternatively, you can install the {% data variables.product.prodname_copilot %} plugin directly into your Neovim config file by running the following command in the terminal:
|
||||
|
||||
```
|
||||
git clone https://github.com/github/copilot.vim.git \
|
||||
~/.config/PATH/TO/YOUR/NEOVIM/CONFIG/FILE/copilot.vim
|
||||
```
|
||||
1. To authenticate and invoke {% data variables.product.prodname_copilot %} run the following command in Neovim:
|
||||
|
||||
```
|
||||
:Copilot setup
|
||||
```
|
||||
{% endlinux %}
|
||||
|
||||
## Seeing suggestions in Neovim
|
||||
|
||||
For guidance on using {% data variables.product.prodname_copilot %} in Neovim, invoke the {% data variables.product.prodname_copilot %} documentation in Neovim by running the following command:
|
||||
|
||||
```
|
||||
:help copilot
|
||||
```
|
||||
|
||||
## Further reading
|
||||
|
||||
- [{% data variables.product.prodname_copilot %}](https://copilot.github.com/)
|
||||
- [About {% data variables.product.prodname_copilot %}](/copilot/overview-of-github-copilot/about-github-copilot)
|
||||
@@ -0,0 +1,109 @@
|
||||
---
|
||||
title: Getting started with GitHub Copilot in Visual Studio Code
|
||||
shortTitle: Visual Studio Code
|
||||
intro: 'Learn how to install {% data variables.product.prodname_copilot %} in Visual Studio Code, and start seeing suggestions as you write comments and code.'
|
||||
product: '{% data reusables.gated-features.copilot %}'
|
||||
versions:
|
||||
feature: 'copilot'
|
||||
topics:
|
||||
- Copilot
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
{% data reusables.copilot.copilot-prerequisites %}
|
||||
- To use {% data variables.product.prodname_copilot %} in Visual Studio Code, you must have Visual Studio Code installed. For more information, see the [Visual Studio Code](https://code.visualstudio.com/) documentation.
|
||||
|
||||
|
||||
## Installing the Visual Studio code extension
|
||||
|
||||
To use {% data variables.product.prodname_copilot %}, you must first install the Visual Studio Code extension.
|
||||
|
||||
1. In the Visual Studio Code Marketplace, go to the [{% data variables.product.prodname_copilot %} extension](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) page and click **Install**.
|
||||

|
||||
2. A popup will appear, asking to open Visual Studio Code. Click **Open Visual Studio Code**.
|
||||
3. In the "Extension: {% data variables.product.prodname_copilot %}" tab in Visual Studio Code, click **Install**.
|
||||

|
||||
4.
|
||||
|
||||
|
||||
## Seeing your first suggestion
|
||||
|
||||
{% data reusables.copilot.supported-languages %} The following samples are in JavaScript, but other languages will work similarly.
|
||||
|
||||
{% data reusables.copilot.create-js-file %}
|
||||
{% data reusables.copilot.type-function-header %}
|
||||
{% data variables.product.prodname_copilot %} will automatically suggest an entire function body in grayed text, as shown below. The exact suggestion may vary.
|
||||

|
||||
{% data reusables.copilot.accept-suggestion %}
|
||||
|
||||
## Seeing alternative suggestions
|
||||
|
||||
{% data reusables.copilot.alternative-suggestions %}
|
||||
|
||||
{% data reusables.copilot.create-js-file %}
|
||||
{% data reusables.copilot.type-function-header %}
|
||||
{% data variables.product.prodname_copilot %} will show you a suggestion.
|
||||
3. To see alternate suggestions:
|
||||
- On macOS, press `Option (⌥) or Alt`+`]` (or `Option (⌥) or Alt`+`[`).
|
||||
- On Windows, press `Alt`+`]` (or `Alt`+`[`).
|
||||
4. If {% data variables.product.prodname_copilot %} offers a suggestion you want to accept, press `Tab`.
|
||||
5. Alternatively, to reject all suggestions, press `Esc`.
|
||||
6. Optionally, you can hover over the suggestion to see the {% data variables.product.prodname_copilot %} command palette for choosing suggestions.
|
||||
|
||||
## Getting more suggestions
|
||||
|
||||
{% data reusables.copilot.suggestions-new-tab %}
|
||||
|
||||
{% data reusables.copilot.create-js-file %}
|
||||
{% data reusables.copilot.type-function-header %}
|
||||
{% data variables.product.prodname_copilot %} will show you a suggestion.
|
||||
2. To open a new tab with multiple additional options, press `Ctrl`+`Enter`.
|
||||
3. To accept a suggestion from the new tab, above the suggestion you want to accept, click **Accept solution**.
|
||||

|
||||
4. Alternatively, to reject all the suggestions, close the "Copilot" tab.
|
||||
|
||||
## Generating code suggestions from comments
|
||||
|
||||
{% data variables.product.prodname_copilot %} can also generate code suggestions from comments.
|
||||
|
||||
{% data reusables.copilot.create-js-file %}
|
||||
1. In the JavaScript file, type the following comment:
|
||||
```
|
||||
// find all images without alternate text
|
||||
// and give them a red border
|
||||
function process() {
|
||||
```
|
||||
{% data variables.product.prodname_copilot %} will suggest an implementation of the function.
|
||||
|
||||
## Using a framework
|
||||
|
||||
You can also use {% data variables.product.prodname_copilot %} to generate suggestions for APIs and frameworks.This example uses {% data variables.product.prodname_copilot %} to create a simple Express server that returns the current time.
|
||||
|
||||
{% data reusables.copilot.create-js-file %}
|
||||
1. In the JavaScript file, type the following comment and then press `Enter`:
|
||||
```
|
||||
// Express server on port 3000
|
||||
```
|
||||
{% data variables.product.prodname_copilot %} will suggest an implementation of the Express app.
|
||||
1. To accept each line, press `Tab`, then `Enter`.
|
||||
1. Type the following comment and then press `Enter`:
|
||||
```
|
||||
// Return the current time
|
||||
```
|
||||
{% data variables.product.prodname_copilot %} will suggest an implementation for the default handler.
|
||||
1. To accept each line, press `Tab`.
|
||||
|
||||
## Enabling and disabling {% data variables.product.prodname_copilot %}
|
||||
|
||||
You can enable or disable {% data variables.product.prodname_copilot %} from within Visual Studio Code. The {% data variables.product.prodname_copilot %} status icon in the bottom panel of the Visual Studio Code window indicates whether {% data variables.product.prodname_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 the color of the status bar.
|
||||
|
||||
1. To enable or disable {% data variables.product.prodname_copilot %}, click the status icon in the bottom panel of the Visual Studio Code window.
|
||||

|
||||
2. If you are disabling {% data variables.product.prodname_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 globally, click **Disable globally**. Alternatively, click the button to disable for the language of the file you are editing.
|
||||

|
||||
|
||||
## Further reading
|
||||
|
||||
- [{% data variables.product.prodname_copilot %}](https://copilot.github.com/)
|
||||
- [About {% data variables.product.prodname_copilot %}](/copilot/overview-of-github-copilot/about-github-copilot)
|
||||
@@ -0,0 +1,92 @@
|
||||
---
|
||||
title: Getting started with GitHub Copilot in Visual Studio
|
||||
shortTitle: Visual Studio
|
||||
intro: 'Learn how to install {% data variables.product.prodname_copilot %} in {% data variables.product.prodname_vs %}, and start seeing suggestions as you write comments and code.'
|
||||
versions:
|
||||
feature: 'copilot'
|
||||
topics:
|
||||
- Copilot
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
{% data reusables.copilot.copilot-prerequisites %}
|
||||
- To use {% data variables.product.prodname_copilot %} in {% data variables.product.prodname_vs %}, you must have {% data variables.product.prodname_vs %} 2022 17.1 or later installed. For more information, see the [Visual Studio IDE](https://visualstudio.microsoft.com/vs/) documentation.
|
||||
- {% data variables.product.prodname_copilot %} is not available for use with Visual Studio for Mac.
|
||||
|
||||
## Installing the {% data variables.product.prodname_vs %} extension
|
||||
|
||||
To use {% data variables.product.prodname_copilot %}, you must first install the {% data variables.product.prodname_vs %} extension.
|
||||
1. In the Visual Studio toolbar, under **Extensions**, click **Manage Extensions**.
|
||||

|
||||
1. In the "Manage Extensions" dialogue, click **Visual Studio Marketplace**, search for the {% data variables.product.prodname_copilot %} extension and click **Download**.
|
||||

|
||||
2. Close the "Manage Extensions" dialog, then exit and relaunch {% data variables.product.prodname_vs %}.
|
||||
3. Optionally, to check that {% data variables.product.prodname_copilot %} is installed and enabled, go back to **Manage Extensions**, click **Installed** to view your currently installed extensions and click **{% data variables.product.prodname_copilot %}** to see status information.
|
||||

|
||||
|
||||
## Authorizing {% data variables.product.prodname_copilot %}
|
||||
|
||||
1. Create a new C# Console App project. For more information, see steps 1 and 2 in "[Tutorial: Create a simple C# console app in Visual Studio](https://docs.microsoft.com/en-us/visualstudio/get-started/csharp/tutorial-console?view=vs-2022)" in the Microsoft Visual Studio documentation.
|
||||
2. Name your project "Copilot Demo" and click **Next**.
|
||||

|
||||
3. Click **Create** to create the project.
|
||||

|
||||
4. A popup will appear with a message to activate your connection to {% data variables.product.company_short %}.
|
||||

|
||||
5. A device code will be copied automatically to the clipboard. Paste it on the {% data variables.product.company_short %} device authorization page that will open. If you miss the device code, you will find it in the status bar, at the bottom left of {% data variables.product.prodname_vs %}, as well as on the {% data variables.product.prodname_copilot %} output window pane.
|
||||

|
||||
6. After successful authorization, proceed to read and approve the [{% data variables.product.prodname_copilot %} Telemetry Terms](/github/copilot/github-copilot-telemetry-terms).
|
||||

|
||||
|
||||
After installation, a {% data variables.product.prodname_copilot %} icon should appear in the editor margin at the bottom of your {% data variables.product.prodname_vs %} window, in the lower left.
|
||||
|
||||

|
||||
|
||||
## Seeing your first suggestion
|
||||
{% data reusables.copilot.supported-languages %} The following samples are in C#, but other languages will work similarly.
|
||||
|
||||
{% data reusables.copilot.create-c-file %}
|
||||
{% data reusables.copilot.type-function-header-c %}
|
||||
{% data variables.product.prodname_copilot %} will automatically suggest an entire function body in grayed text, as shown below. The exact suggestion may vary.
|
||||

|
||||
{% data reusables.copilot.accept-suggestion %}
|
||||
|
||||
## Seeing alternative suggestions
|
||||
{% data reusables.copilot.alternative-suggestions %}
|
||||
{% data reusables.copilot.create-c-file %}
|
||||
{% data reusables.copilot.type-function-header-c %}
|
||||
{% data variables.product.prodname_copilot %} will show you a suggestion.
|
||||
3. To see alternate suggestions, press `Alt`+`]` (or `Alt`+`[`).
|
||||
4. If {% data variables.product.prodname_copilot %} offers a suggestion you want to accept, press `Tab`.
|
||||
5. Alternatively, to reject all suggestions, press `Esc`.
|
||||
6. Optionally, you can hover over the suggestion to see the {% data variables.product.prodname_copilot %} command palette for choosing suggestions.
|
||||
|
||||
## Generating code suggestions from comments
|
||||
{% data variables.product.prodname_copilot %} can also generate code suggestions from comments.
|
||||
|
||||
{% data reusables.copilot.create-c-file %}
|
||||
1. In the C# file, type the following comment:
|
||||
```csharp
|
||||
using System.Xml.Linq;
|
||||
|
||||
var doc = XDocument.Load("index.xhml");
|
||||
|
||||
// find all images
|
||||
```
|
||||
{% data variables.product.prodname_copilot %} will suggest an implementation of the function.
|
||||
{% data reusables.copilot.accept-suggestion %}
|
||||
|
||||
|
||||
## Enabling and disabling {% data variables.product.prodname_copilot %}
|
||||
|
||||
The {% data variables.product.prodname_copilot %} status icon in the bottom panel of the {% data variables.product.prodname_vs %} window indicates whether {% data variables.product.prodname_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.
|
||||
|
||||
1. To enable or disable {% data variables.product.prodname_copilot %}, click the status icon in the bottom panel of the {% data variables.product.prodname_vs %} window.
|
||||

|
||||
2. If you are disabling {% data variables.product.prodname_copilot %}, you will be asked whether you want to disable it globally, for the file you are currently editing, or for the current file type.
|
||||
|
||||
## Further reading
|
||||
|
||||
- [{% data variables.product.prodname_copilot %}](https://copilot.github.com/)
|
||||
- [About {% data variables.product.prodname_copilot %}](/copilot/overview-of-github-copilot/about-github-copilot)
|
||||
14
content/copilot/getting-started-with-github-copilot/index.md
Normal file
14
content/copilot/getting-started-with-github-copilot/index.md
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
title: Getting started with GitHub Copilot
|
||||
shortTitle: Get started with GitHub Copilot
|
||||
intro: 'You can start using {% data variables.product.prodname_copilot %} by installing the extension in your preferred environment.'
|
||||
versions:
|
||||
feature: 'copilot'
|
||||
topics:
|
||||
- Copilot
|
||||
children:
|
||||
- /getting-started-with-github-copilot-in-visual-studio-code
|
||||
- /getting-started-with-github-copilot-in-visual-studio
|
||||
- /getting-started-with-github-copilot-in-jetbrains
|
||||
- /getting-started-with-github-copilot-in-neovim
|
||||
---
|
||||
Reference in New Issue
Block a user