Using GitHub Copilot to Write and Manage Code

In this GitHub Copilot blog post, we will show how to get started with Copilot using VS Code and how to write and manage code.

Without many explanations, GitHub Copilot is an AI assistant for writing code in many programming languages. This post will focus on setting VS code and using copilot with PowerShell.

Signup Process

GitHub Copilot is a paid service that starts at $10 a month for personal use with a few limitations. As shown below, we signed up for the Copilot Business package, which offers great features.

To sign up for the business package, you must set up a free GitHub (free) if you don’t have one.

Setup VS Code

Once your GitHub org is configured and you’ve assigned a Copilot seat to your users or yourself, it is time to set up VS Code.

First, install the GitHub Copilot extension in VS Code (shown below).

After finishing the installation, a pop-up window will appear in VS Code, asking you to sign in to GitHub Copilot and activate the service.

After signing in, you can access Copilot from VS Code using the Copilot icon at the bottom right corner.

Start Writing and Managing Code

It’s time to witness Copilot in action. Before getting started with Copilot, you should keep in mind that the file you are working on needs to be saved with the code language extension first.

For example, if you start writing a PowerShell code, save the file as PS1 before starting work with CoPilot. This will allow Copilot to focus more and provide better results.

When you open a new file, you will see the following message from Copilot.

Press Ctrl + I to access Copilot and ask what you are after in natural language.

You can also access Copilot from the Chat menu and ask questions.

You can also highlight a code block in the code editor and use the /explain Copilot command to get Copilot to explain what the code does.

The output is shown below.

If you type / you will see the Copilot has some ready commands you can use


Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.