GitHub Copilot in VSCode: Top 10 Features Explained

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video I'm going to cover the top 10 features of GitHub co-pilot the very first thing that I want to show you are question and answer blocks so over here you can see that I have an empty python file and when I write a comment with a hashtag followed by a q and a colon I can write any question I want such as what does rest stand for and then when I switch line you will see that it gives me an answer this is really convenient because it saves you the time of having to open the sidebar chat window to ask your question but one thing that you should be aware of is that you use the appropriate comment notation depending on the coding language so if you were in a Javascript file you would use two forward slashes to create a comment instead of the hashtag the second thing that you should know is how you can interact with GitHub co-pilot from your editor so apart from the method that I just showed you with the question and answer blocks another way is by pressing control shift and I and this opens a small window at the very top and at the top you can now go ahead and ask your question such as how many bits are in a bite and after a moment of thinking it is going to give you the answer to your question and the next way that you can also interact with GitHub copilot is through the side window so one way of opening it is by pressing the small icon over here at the top that is going to open the question on the left side barar but you can also press on this little chat icon so that is also going to open up this chat window the next thing that is really helpful to know is that GitHub co-pilot supports your native language if for example your native language is German and you write something along the lines of this modu P game which translates to import the module Pi game you're going to see that it does exactly that without you having to write everything in English this is nice to know especially if your native Lang language is not English or if you have some word that you've simply forgotten in English the fourth thing that I want to show you is how you can cycle through suggested code Snippets and how you can open the suggestions within a new window let's say for example you want to create a function that calculates the number of days that lie between two dates so within a comment we can simply write something along the lines of calculate days between two dates and afterward Ward when we Define the function we get a code snippet that is suggested and if we hover over the code snippet that's suggested you will see that there's the small popup and it says one out of three and that is because we have three suggestions and we can simply skip through these Suggestions by clicking on this right arrow but if you want to see even more suggestions and want to open that within a new window you can simply press control and enter and you will see on the right hand side it opens a new window where you'll be able to see all the individual suggestions that there are and if you want to choose one of these suggestions you can simply click on accept solution so for example if I take this one over here and accept it it will be brought over into my window now let's get to the fifth thing on my list which is the built-in fix it and explain it feature so we just added this one function to the editor and what you can do is you can highlight it right C click on it and under co-pilot you can click on explain this what this will do is it will open the side window and it's going to explain what the function actually does so as you can see here as we speak a small explanation is being added to the leftand chat window explaining what exactly it is that this function does so that's the explain this feature let's talk about the fix this feature because that's quite helpful too so let's go ahead and break this function by simply removing one of the arguments and then the next thing that we can do is we can highlight it and we can go to the copilot and click on fix this and it will automatically detect that there's something wrong and you can see that it suggests that we add this second argument back to our function and we can go ahead and accept this change and you'll see that it's now fixed again the sixth thing on my list is one of my personal favorites which is the terminal fix this function this allows you to fix the errors that come up in your terminal using one click so over here I'm going to go ahead and add a print statement that is going to calculate the difference in days between two dates and I'm going to deliberately leave one closing bracket away so that's going to give me an error so now when I go ahead and run this in Python um you can see that in the terminal output it's says that there's a syntax error and that the bracket was never closed now if I go ahead and press on these two star icons and subsequently press on explain using co-pilot you can see that the top window opens and it's going to give me an explanation of what went wrong in the terminal and it even gives me the possibility to copy the fix straight away when and subsequently I can go ahead and paste it and now everything is going to run just as it should giving me the correct answer the seventh feature on my list are automatic commit messages whenever you have made changes to your project and you want to commit these changes to your GitHub repository you need to add a message to your commit and that can be quite cumbersome sometimes but GitHub co-pilot makes it really easy for you because all you need to do is you need to press these two star icons in the message Banner and it automatically creates your uh commit message for you so this is quite nice because it saves you the time of having to come up with some sort of creative commit message every time number eight on my list are something that we call agents agents allow you to provide some context with your prompts and the context is usually the code that you have written in your editor what that means is that when you send a prompt using GitHub co-pilot the answer will not only be based on all the data that's been fed into chat GPT 4 which is what all of this is running on but also the code that is in your workspace to demonstrate how this works take a look at the project that I'm currently working on this is a Chrome extension and it has a pretty large code base so what I can do in the co-pilot chat is I can write at workspace which is going to give my prompt the context of my entire workspace and I can ask it a question so such as where in my workspace do I use instances of the class App Manager now this is going to take just a moment to process but after a few moments you will see that it says where exactly within my code base I have used the instance of the class app manager so this saves a ton of time especially if you're trying to figure out where exactly features are implemented within your code Base number nine is another agent that you can use in the chat window which is the ATVs code agent this agent enriches all your prompts with information about vs code so if you have a question regarding VSS code such as where a feature is located or how to do something you can use this agent and it will give you very precise information about how to solve your problem so for example if I want to change the theme of my VSS code editor what I can do is I can write at vs code and subsequently I can write the question that I want to ask which is how do I change the theme and in just a moment you will see that GitHub co-pilot will respond and you can even show the command in the command pallet so when I click on show in command pallet you'll directly be navigated to the command that allows you to change the theme and the 10th feature that I want to share is going to be down in the comments below which is where I want you guys to share your most popular features and any of the ones that I have missed we're going to leave it at that for this video and if it helped you out then make sure to leave this video a like And subscribe to this channel see you in the next video
Info
Channel: Max on Tech
Views: 11,456
Rating: undefined out of 5
Keywords: VSCode, GitHub Copilot, Copilot, Pair Programming
Id: 2nPoiUJpDaU
Channel Id: undefined
Length: 8min 43sec (523 seconds)
Published: Fri Dec 29 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.