My Experience with GitHub Copilot
Duc Nguyen Thanh
Posted on October 30, 2024
Hello,
I'm Duke and I recently dove into using GitHub Copilot, and I’ve got to say, it’s been quite an adventure! I integrated it with a couple of languages—Python and .NET—and tried it out on several popular IDEs, including VSCode, Visual Studio, Rider, and PyCharm. Here’s a rundown of what I found during my experiments.
Setting It Up
Getting GitHub Copilot up and running wasn’t too tricky. However, if you’re using Visual Studio, make sure you’re on version 17.10 or later (2022). It’s a little bit of a hurdle if you're on an older version, but once you get through that, you’re good to go.
Compatibility
One of the great things about Copilot is its compatibility. It works seamlessly with major IDEs like Visual Studio and VSCode from Microsoft, as well as Rider and PyCharm from JetBrains, all thanks to various extensions. This makes it pretty versatile and easy to use across different setups.
Code Generation Quality
Now, let’s talk about the meat of it: the code generation quality.
Automatic Code Generation: Copilot can auto-generate code from files or even create new files for you. I noticed it follows coding conventions pretty well, especially for Python, where it adheres to PEP 8 standards. That’s a big plus!
Prompt-Based Code Generation: When generating code through prompts, it’s crucial to be specific. I found the best results came from using a structure like: . The more precise you are, the better the output.
Function Name Suggestions: Copilot provides a ton of suggestions based on function names, but make sure those names are clear and descriptive. The clearer the name, the better the suggestions.
Code Explanation: One of my favorite features is how Copilot can explain code. It can quickly scan a file and give you explanations for both single lines and entire sections. This contextual understanding is super helpful for grasping what’s going on in the code.
Auto-Fixing Code: It can attempt to fix code, but I found it lacking in some areas. For instance, I tried to get it to correct a Triangle algorithm error, but it didn’t get it right. There’s definitely room for improvement here.
Conclusion
Overall, GitHub Copilot has been a solid tool in my coding toolkit. While it’s not perfect—especially when it comes to fixing errors—it shines in code generation and explanations. If you’re diving into coding, especially with Python or .NET, it’s definitely worth giving Copilot a shot. Happy coding!
Posted on October 30, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.