So you've got GitHub Copilot.
Congrats - Copilot can help you level up your skills as
a developer in ways that you probably thought were not
possible.
Seriously.
But now that you've got it, where do you start?
How does it work?
What do you need to learn?
We're gonna answer all of that in this video, and
I think you'll find that once you know how and
where to use Copilot, it is pretty simple to dramatically
increase your speed and productivity almost immediately.
The secret of GitHub Copilot is that there isn't anything
special that you need to do to learn how to
interact with it.
All you have to do to use GitHub Copilot is
code.
That's it.
Just code like you normally would and watch the AI
go to work.
This is called "Ghost Text", and it's automatically turned on
when you install the extension and log in to GitHub
Copilot.
You can verify that Copilot is active by checking for
the GitHub Copilot icon down here in your status bar,
and if you want to turn Copilot off for a
specific file or language, click on this icon and you
can disable it.
You can also trigger Ghost Text by writing a comment
expressing what you want.
To accept a Ghost text completion, press Tab.
If you only want part of the ghost text, you
can just hold down the Control or Command keys and
press the right arrow to accept as much or little
of it as you want, and you can hit escape
at any time to dismiss the ghost text.
You can do a lot with just Ghost Text, and
you'll find that Copilot is remarkably good at anticipating your
next move and doing a lot of the work for
you.
For example, if I create a variable called nums, Copilot
gives me what I probably want based on the name
of the variable and the function in the file already
an array of numbers.
And if I press enter below the function, it assumes
that I want to call the function and pass in
the nums variable, which is exactly what I want.
Now Ghost Text may give you what you want, or
it may be close and almost, but a miss.
In that case, you can see some alternative suggestions by
pressing the Control or Command and Enter keys.
This opens up a side panel where you can see
more suggestions from the AI that you might like better.
The other way that you can use GitHub Copilot right
in your code is to chat with it directly, right
here, using something that's called "Inline Chat."
This can be triggered with the Control or Command and
I keys.
None of this code actually exists in your file until
you accept it, so if you hit escape it will
all just go away.
No harm, no foul.
Inline Chat is great for iterating on your code right
in line.
So for instance here,
perhaps we want to return a static file at this
route instead of what Copilot gave us, so we can
highlight the block and iterate on that with Inline Chat.
And Inline Chat always gives you a diff view showing
you what's been added and changed so that you can
be sure that this is what you want before you
accept it.
GitHub Copilot also features a more traditional dedicated chat area
in the sidebar that you can access by clicking on
the chat icon.
If you've ever used another AI chat before, this will
feel very familiar.
While Ghost Text and Inline Chat are good for helping
you code faster, chat is good for helping you solve
problems and make decisions quicker.
It is terrific for brainstorming and figuring out implementation details.
You can always customize where the chat appears in your
editor.
So, for instance, if you'd like to see your code
and your project files in the chat all at the
same time, you can click on the secondary sidebar icon
and just drag the chat into that sidebar.
All of your chats are saved to a history that
you can access at any time with the history icon
at the top of the chat.
There are a few other places that you'll find GitHub
Copilot, and it can be quite useful.
One of them is when you have a problem in
your code,
you'll find GitHub Copilot here in the light bulb or
quick suggestion menu where it can explain and often even
fix your errors right inline.
Copilot is extremely good at fixing silly mistakes and explaining
compiler errors that otherwise make no sense.
You'll also find GitHub Copilot anywhere that you see this
sparkle icon.
This includes places like the Terminal and anywhere that GitHub
Copilot might be able to help you out.
All you have to do is keep your eye out
for the sparkle and when you see it, give it
a click and see what Copilot can do for you
right then and there.
And believe it or not, that's it.
You now know the essentials of how to interact with
GitHub Copilot.
Go forth and see how much better life can be
as a developer and make sure you check out our
other videos on GitHub Copilot for all your AI coding
needs.
Happy coding.