childebrandt42

Worthless info……………Oh blinky lights!

The greatest coding tool to date! GitHub Copilot long term review.

Posted by

·

, , , ,

Well as you all know if know there is some pretty amazing advancements made in AI, one of the ones I have not had time to really dig into was Copilot! Over the almost a last year or so I have had some nights and weekends to devote to working with this amazing tool! And here it is…

What is GitHub Copilot? Well, if you ask ChatGPT this…..It gives you a ton, but let’s summarize it a bit:

GitHub Copilot is an AI-powered coding assistant developed by GitHub and OpenAI”

GitHub Copilot is a paid for tool, and you must sign up for the service. You can do so here. At first you get a 30-day free trial and $10 a month more and requires you to have a GitHub account and also use Visual Studio Code for your coding. Once you sign up for the service you must install it in Visual Studio Code.

Lets jump into the things that makes it great!

GitHub Copilot Chat Feature

One of my favorite functions of this is the Chat Feature. You can tell Copilot what you want and it will do what you ask. For example, I entered the following in to the chat, boom!

Export a list of all Active Directory users in a domain with the following details.
First Name
Last Name
Display Name
Office
Full Address
Telephone Number
Email Address
Job Title
Department
Company
Manager Name
Export the data as CSV

Domain as Variable
Export location as Variable

And after hitting enter, we get the command output.

But if you don’t like what you get after you hit enter, you can push ctrl + enter and it will open a new Tab, and create 10 alternates to the code, like so:

You can choose alternates from the list and paste into your code.

Using this same example, I do want to say it’s not perfect yet, but getting really good at every revision as it grows.

As you can see above, it did not put the text behind a # symbol, and also them used a comma that in turn the rest of the code is all sorts of messed up.
There are many more things the chat feature can do, but its huge for helping figure out dumb loop issues.

Auto Complete feature

GitHub Copilot has an autocomplete function in it. This is extremely handy to have at your disposal, it makes coding so much faster and easier. You can enter a comment like below, and it will auto generate code for that comment in gray below. You can tab to accept it and put it into your code

You can keep this up, and pretty much Copilot will write a good portion of the code for you, Again you need to watch out as its not perfect and does make some mistakes from time to time. But makes mondain code writing much faster, as you don’t have to type every thing, or go find it in your existing repo of code. Oh, and that brings another thing, is GitHub copilot will pull code from your existing code repo! Yes, if you typed code before it will parse it and use that in your suggestions. As you notice below, was from the commands that were auto generated but instead I just typed all of this code by using comments only, I did not write a single thing in actual code.

It is really good for saving you many keystrokes by helping you complete loops for example here, of just writing a comment like this: “For each user find the users with the same manager” oh and the best part it actually auto completed the comment for me too. When you enter after that comment you get this result:

Documenting your code

One of the features I use a ton, is documenting! So took the same code it auto generated for you. If you highlight the code, you can hit ctrl + I again, and not this time press the “/” and you will see some new options one is /Doc

And it will document the code for you.

You can accept the value and get fully documented code quick!

Fixing your code with GitHub Copilot

As you all never make mistakes in your code, and may never need this feature, but I sure do! Like above, you highlight your code press crtl + I and “/fix” and it will suggest fix’s for all of your code.

or you can do things a bit different and just fix a single thing. If you hold your mouse over an errored section or something that might not meet standards, you can choose “Quick Fix”

When you choose Quick fix, it will prompt you with option to fix with Copilot like so:

Or there is a right click option if you right click on the “$users -eq $ null section and go down to copilot and choose fix!

This same right click context is there for all the things we have covered so far. And a few more.

Generating Tests

We are going to keep using the same block of code, but if you highlight and do the crtl + I and then do /test or right click and choose copilot, and Generate Test you can generate testing code for the code you wrote, for this AD script it’s kind of dumb, but if you built a script to check for prime numbers or something like that would be more reasonable. But to keep consistent, it generated below for testing code:

GitHub Chat

I don’t typically use the chat bar much, but it’s a great option, on the activity bar, there is a chat function, and you can ask questions for simple things like “Command for finding all my running processes” if you forget one, or just things like

Conclusion

At this point I’m just touching the tip of what Copilot can do, and how it helps me on day-to-day basis. But it’s a huge help for me! I don’t always code as part of my day-to-day job but do a ton for the community and for fun! Yea I do coding for fun! I actually really enjoy coding and really hate the little things with it and adding the $10 a month Copilot subscription has paid for itself more than 10-fold! So for me Copilot has been a huge asset. It has increased my productivity, and well worth the investment.

childebrandt42 Avatar

About the author

Hi! My name is Chris Hildebrandt, I’m a EUC consultant by day, and automation junkie at night. I have worked my way from being small customer to enterprise side customer, with a recent transition into consulting. I enjoy everything EUC focused and more so on how to automate it. I like to find ways to make mine and your jobs easier with automation.