Sunday 2 October 2022

Getting Started with GitHub Copilot with VS Code

GitHub Copilot is the AI pair programmer who will assit us in writing code efficiently, while we are working with VS Code, Visual Studio, JetBrains IDEs or Neovim. Let's explore how to get started with GitHub copilot with VS Code and C# using a console application.

Before begin anything once we have copilot enabled in GitHub we need to complete the setup by deciding whether to allow code suggessions based on public code available in GitHub or not.

For now, let's block code suggestions from public code and allow the code we develop to be used for improvement of copilot.

Let's create a new respository in clone it in VS Code to get started.

We need to setup the GitHub Copilot extention in VS Code to enable copilot assistanc while we code.

Once installed we have to sign in to GitHub to enable using Copilot. You will see the Copilot icon in the status bar at the bottm of VS Code.

Copilot will be enabled when you signed in to GitHub. You can enable/disable copilot by clicking on the copilot icon in VS code status bar. 

We can enable/disable copilot globally for all languages or for a given language we are working on.

Let's create console app with .NET 6 and test copilot a bit. Once start typing double add copilot suggested the method as shown below. Hit Tab and the suggestion will be applied.

Stream readtextfile suggest as below.

Let's explore more on copilot in future posts.

No comments:

Popular Posts