How I'm Using GitHub CoPilot In VS Code

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] [Music] Microsoft acquired GitHub in 2018 then they bought half of open AI in 2019 and then open AI release chat GPT in December 2022 so around 6 months later in May 2023 GitHub rolled out a major redesign a co-pilot that leverages the unique generative AI capabilities of open AI further trained on data from GitHub and Microsoft the new GitHub co-pilot is amazing but you have to know how and when it can be useful and that's exactly what we're about to talk about [Music] all right enough of the formalities let's get into it what I thought I was going to do was sign up for the free trial bone up on co-pilot make this video and then kill the subscription however I love the product and I am now a paying customer more specifically and more importantly I want to show you how I'm using co-pilot inside of vs code you're going to love our game plan today screw demos we're about to use co-pilot right now inside of vs code on a real project to do some real work right now this repository is for a video that I recorded a couple of weeks ago to create an AWS rest API Gateway in Lambda function that handles calls to the open AI python API cool huh all right here's the situation this is a good repo but it could be better we're mostly going to focus on the python code for the Lambda that handles the open aai API calls so this would be kind of a double bonus for any of you who are also interested in creating custom openai applications using nearly free serverless gear from AWS and co-pilot is going to act as our code pair today to help us identify Improvement areas in this code this video is not sponsored by the way I just think co-pilot's worthy of your attention it's great product here's what you have to do inside of V Code by the way to get this set up I'm going to travel over to extensions and I think it's called copilot copilot yeah here it is and it's as simple as running this install and you're done and then what that's going to get you is four different things we're going to look at all four of those right now so we'll just hit it piece by piece all right um so where I mostly use co-pilot is for what I would consider the mundane but important and knowledge and intensive kinds of stuff so let me give you hard examples uh this here uh toxin which you need to get flake8 set up for python is a good example of something that's knowledge intensive in my personal opinion I find it just a little bit Arcane just simply because I'm not in here on a daily basis and so here's your first example of co-pilot going to work for us so um this is text completions inside of a source file document and so here it's prompting us for uh what it thinks would be a reasonable next thing to put in this file if we felt so compelled uh and so if I hit the tab key it'll accept that suggestion and it'll keep doing this until it runs out of suggestions and so looks like that's it for py test and here's for python coverage with some stuff all right and goodness there's a bunch and more all right you get the idea so so that is uh text completions now so I have this make file and uh this is the same thing make file is another case where uh I find what's in here just a little bit Arcane and esoteric simply by virtue of me not spending a whole lot of time making make files and so I know I know have to get by but that's about it so here's I'm going to do I'm going to use uh comment prompting in this case and I'm going to give it I'm going to give co-pilot some instructions I'm going to say um set up a basic uh python environment and terraform because we have some terraform code in here yeah all right let's just see what it comes up with all right making it run make a net yeah yeah exactly uh-huh uhhuh [Music] and I don't understand um that was kind of a bust okay um well I didn't get anything good with that so let me try uh the chat functionality and by the way I've taken co-pilot chat and I've penned it to the right hand side barar say provide suggestions for this makefile now that's pretty I'm I'm breaking my own rules uh just kind of on purpose and that the instruction that I just provided is not really that specific but nonetheless look there's there's some pretty good suggestions in here um this actually is something that you're supposed to do I don't actually know why but you're supposed to put that uh in your make files and I forgot to do that and then uh they've got this nice clean and test we don't need the build CU this is a Lambda but these are useful uh those those are good suggestions so I'm going to say Point score co-pilot all right moving on okay so let's spin the balance of what time we have left inside of python and um let's see you've seen the chat window and we've seen prompting a couple text completion and prompting and so now let me let me manufacture a bug if we're here we go so here's a here's a call to something it's got um it's not that complicated either but here we'll just do this I'm going to I'm going to delete this comma and then that piece on top that's coming from the cornflakes extension for Python and then the let's see this didn't stream it didn't come up with uh a quick fix via co-pilot so I'll right click on this and we can do it this way um so you get co-pilot in the context menu once it's set up and running and then we can ask co-pilot to fix this syntax error for us and U so far it's done pretty good it's not as fast as I'd like it to be but it um it hasn't butchered any of my code so far when I use it for these fixes now having said that I I haven't I haven't run across a real Zinger of a python bug um that I could try it on so um I don't know if you have then drop a comment and uh help us all out all right uh this is par for the course so it figured it out it added the comma but co-pilot fixed it for us we can also use co-pilot to get narrative explanations of our code by highlighting it and then asking it to explain it like this you can do this two ways you can also just type in explain this in the chat bar and it it it it understands both instructions the same okay so look over here and yeah that's an accurate explanation of what this python code does and so if you're learning python then that's that could be helpful okay last thing here's what I want to do for my last trick is uh I I've recently installed flake 8 in this project but I haven't really made use of it so I'm going to run flake 8 on the command line right now and see what comes back and kind of the idea here is that we can depend on flake 8 for the opinionated uh judgments but we can use co-pilot perhaps uh to try to take care of any of the criticism that comes back from flake8 hey not bad so apparently I'm just missing some dock strings on uh some of the functions so let's look at a couple of these and see if we can make use of co-pilot to speed things up for us with these missing dock strings so this here well yeah good point um I should have put a dog string in here and I didn't and so it gave us that's not that interesting um let's see how about this let's do this I'm going to highlight it go over here let me clear this and then how about this suggest a more detailed doc string and see if it comes up with anything better than what it gave us there he hey look at that okay that's that looks more Pro all right so and I'll just grab this pretty cool so these are the kinds of things that I think copilot is particularly useful for by the way you might also be interested in this video from github's product manager Allison Weiss and developer Advocate Burke Holland uh they are both delightful intelligent and very knowledgeable on how to get the most out a co-pilot by the way you can follow this QR code to get signed up for a free trial all right well that's all for now uh I hope you found this helpful and if you did then consider liking and subscribing because that really helps and it'll help you to see more great videos like this and I will see you in the next [Music] video w
Info
Channel: FullStackWithLawrence
Views: 5,218
Rating: undefined out of 5
Keywords: github copilot, github copilot tutorial, github copilot chat, github copilot review, github copilot vscode, github copilot python, github copilot demo, how to use github copilot, github copilot install, vscode github copilot, github copilot x, visual studio code, visual studio code tutorial, vs code shortcuts, vscode tutorial, vscode python, vs code installation for python, github copilot c#, github copilot tutorial for beginners, github copilot vscode setup
Id: kVO0eYhN6dE
Channel Id: undefined
Length: 11min 1sec (661 seconds)
Published: Fri Oct 06 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.