GitHub Copilot Top Features Explained

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video I'm going to show you the best features of GitHub copilot this is coding with item and let's check out those features the first feature we're going to check out from GitHub co-pilot is realtime suggestions as we start to type our code it's going to give us ghost text that ghost text will appear as gray text and if you put your mouse over it you can go ahead and cycle through the different options or you can go ahead and click on accept over here or use the tab on your keyboard you can even accept one word at a time we're going to go ahead and accept this suggestion as we move from one line of code to the next it even predicts the next piece of code that I need in this particular example it's something called the context and the context is used to draw to the canvas real time suggestions can even create complete functions for you for example let's say that we want to draw a circle when we type the text to draw Circle it gives us ghost text once again we can then cycle through the options over here we're given two options or we can click on the three dots over here and open the completions panel you can also access that by pressing control and enter both on Windows and on Mac and then we can scroll through the suggestions and in this particular window over here you can see we have even more suggestions to pick from so let's go ahead and accept one of these suggestions and it fills the code in for us the other thing you'll notice is that it's aware of all the code in the file and even uses the CTX that we created on a previous line within this function the next feature that we're going to check out is the inline chat anytime you create a brand new file you're going to be presented with this text over here and for your particular operating system it's going to let you know which keyboard shortcut you can use to open the inline chat on a Mac I can just use command and I when we press our shortcut it's going to open the inline chat from there we can ask co-pilot to do something or execute one of its commands we're going to ask it to please create math functions for add subtract divide and multiply being polite isn't a requirement but you can if you want we'll go ahead and hit enter when we hit enter gith up copilot's going to generate the code for us it's generated all of these functions and we can choose to either accept or discard it if we accept will'll have those functions in our file we can even use the inline chat to modify the code for example I can go ahead and highlight all the code and ask it to add export to all functions after it's made the changes we can go go ahead and review them and accept them if we like them with the inline chat we can also highlight a function or a block of code and modify it in this particular example we're going to ask it to use better names for the parameters when we do that it's going to go ahead and change the ab to num one and num 2 we can go ahead and accept that another awesome feature of the inline chat is that we're able to use our voice to change code by clicking on the microphone icon remove all comments after you say the command and you stop talking it executes the command and as you can see it removed all comments we can go ahead and accept that the next amazing feature of GitHub co-pilot is that it can generate tests for us I've created a file ahead of time called calculator test.js and this file is empty within the calculator. JS you can either select all the functions or in between the functions open up the inline chat type SL test and we're give it a bit of extra information to use es6 Imports and to not use describe we'll hit enter then it's going to go ahead and create our test for us it's going to give us this diff between what was inside the calculator test.js before and after as you can see it's using the es6 Imports and there are no describes around our tests when we accept that we can go ahead and open our calculator test.js and we'll find all of our tests over here we can then go ahead and execute our test to make sure that they pass and as you can see all the tests that were created by GitHub copilot are passing another cool feature of GitHub copilot is that it can generate documentation for you within this file over here we're going to go ahead and execute the doc command by typing slash do it's going to generate the documentation for this file now we can see on every single function over here we have proper documentation which even includes the error case in our divide function another awesome feature of gith up copilot is that it can fix errors in your code let's add an error on on purpose to our divide function we're going to say B is equal to zero then we're going to ask GitHub co-pilot to fix this function we'll bring up the inline chat and we're going to execute the fix command it'll analyze the code and then determine that we should be checking for equality versus assigning the value to zero we can see that it's found the error and corrected it and we can go ahead and accept that change next we're going to check out the explain command the explain command is used to understand a code by highlighting a code block or a function we can ask GitHub co-pilot to explain the code we simply just execute SL explain hit enter and then it leads us into our next feature called the chat panel from here it's going to give us a detailed explanation of the code that we highlighted within this chat panel we can go ahead and have a back and forth with GitHub co-pilot we can ask it questions just like you would with open AI chat gbt for example we could go ahead head and ask it to explain the export function in a simpler way so we'll ask it can you provide a simpler explanation of export for beginner developer and when we do that it's going to give us a more detailed explanation of export the co-pilot chat panel is a powerful feature that allows you to ask questions right within vs code you don't have to go to Google or stack Overflow to find the answer you can ask right within co-pilot one thing to keep in mind with the co-pilot chat is that you can only ask it program programming related questions if you ask it a question that's not programming related like asking it to name all 50 states in the United States it'll let you know that it can only assist you with programming questions however if you reword your question to be more programming related you can sometimes get the answer that you're looking for for example I asked it to put all 50 states in an array and now I have the answer to what all the 50 states are in the United States next we'll take a look at how we can generate commit messages using GitHub co-pilot so let's say for this project that I just want to check in one of my files now anywhere that you see these Sparkles that means you can click it and GitHub copilot can do something so in this particular instance over here when we click the Sparkles it's going to go ahead and generate a commit message for the code that I am committing now that it's helped us generate our commit message we've noticed that we have 4,000 files in our project that need to be committed well naturally we know the problem is our node modules over here so we're going to ask the chat how do we generate a g ignore GitHub co-pilot will then give us the instructions that we need to create the ignore file if we need more information we can ask it to elaborate on those items following the instructions will tell us that we need to create a dog ignore file we'll create that in the root of our project and then we can go back to the chat and the chat gave us an example ignore file with theg ignore file open we can either go ahead and copy that text or we can go ahead and insert at cursor then we can go back to our source control and see that the dog ignore has solved our issue the next set of features in vs code is called agents and you can access agents by typing at within the chat and there's three agents terminal vs code and workpace the workspace allows you to ask questions about the code in your project for example we can ask where is the best place to put math functions in my code when we execute that it's going to go ahead and decide what information to collect analyze and filter that information and then come up with an answer to tell you that the best place to put a math function with an our code is calculator. JS the next agent that we'll take a look at is VSS code the vs code allows you to ask questions about vs code for example we can ask how do I change the theme it'll then look at your question take a look at the documentation and then tell you how you can change your theme for example it'll tell us we can go to preferences color theme command and even give us a button that we can click over here to quickly jump to the themes lastly we have the terminal agent which can be used to help you write terminal commands for example we can ask it how do you use git to commit all changes when we ask that question it's going to go ahead and show us the exact command that we need to execute it'll even let us know that we need to go ahead and fill in the commit message we can then copy it insert it at the cursor location or even click this button over here to open the terminal and paste the command in for us we can then replace the commit message and execute that command the last feature is to follow the Sparkles for example there's a sparkle in our commit message over here within the code base you can see the sparkle here and if I click on it it brings up GitHub copilot and even when I'm highlighting code it has a sparkle although it's obscured a little bit behind the light bulb it is there and as time goes on I'm sure we'll find the sparkle icon in even more places within vs code when and you're using GitHub co-pilot if you enjoyed this video like subscribe and hit that notification Bell
Info
Channel: Coding With Adam
Views: 6,396
Rating: undefined out of 5
Keywords: github copilot, copilot, vs code copilot, to features, copilot features, features copilot, copilot tricks, inline chat, chat panel, top 10 features, top 12 features, copilot 101, copilot tutorial, tutorial for copilot, git hub, git hub copilot, all features of copilot, AI assitant, vs code ai, ai for vs code, how to use copilot, copilot learn, learn copilot, using copilot, using copilot in vs code, coding with copilot, real world example copilot, teach me copilot
Id: KjyMQzoJo8Y
Channel Id: undefined
Length: 9min 36sec (576 seconds)
Published: Mon May 13 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.