"AI won’t replace engineers. Engineers who use AI will replace those who don’t."
Introduction
GitHub Copilot is an AI-powered code completion tool that helps developers write code faster and more efficiently. Integrated with Visual Studio Code (VS Code), Copilot suggests entire lines or blocks of code based on context, significantly reducing development time. In this blog, we'll cover how to set up GitHub Copilot in VS Code, how to use it effectively, and how it can drastically enhance a developer's productivity.
Setting Up GitHub Copilot in VS Code
Step 1: Install GitHub Copilot Extension
- Open VS Code and navigate to the Extensions Marketplace (
Ctrl+Shift+X
). - Search for GitHub Copilot.
- Click Install.
Step 2: Enable GitHub Copilot
- Open VS Code Settings (
Ctrl+,
). - Search for GitHub Copilot and ensure it is enabled.
- Sign in to your GitHub account and authorize GitHub Copilot if prompted.
Step 3: Configure GitHub Copilot
- In VS Code, go to Settings > GitHub Copilot and adjust preferences such as inline suggestions and accepted file types.
How to Use GitHub Copilot
Once installed and configured, using GitHub Copilot is simple. Start typing in any programming file, and Copilot will provide auto-suggestions.
Example: Creating a Blockchain API
I created a simple server.js file using Node.js and Express, defining a blockchain implementation:
Generating Test Cases with Copilot
To verify the functionality of our blockchain API, we need test cases. Instead of writing them manually, I let Copilot generate a server.test.js
file automatically, making the process effortless.
const request = require("supertest");
const app = require("./server");
describe("Blockchain API", () => {
it("should return the blockchain", async () => {
const response = await request(app).get("/blocks");
expect(response.status).toBe(200);
expect(response.body).toBeInstanceOf(Array);
expect(response.body.length).toBeGreaterThan(0);
expect(response.body[0]).toHaveProperty("index", 0);
expect(response.body[0]).toHaveProperty("data", "Genesis Block");
});
it("should mine a new block", async () => {
const data = "Test Block";
const response = await request(app).post("/mine").send({ data });
expect(response.status).toBe(200);
expect(response.body).toHaveProperty("index");
expect(response.body).toHaveProperty("previousHash");
expect(response.body).toHaveProperty("timestamp");
expect(response.body).toHaveProperty("data", data);
expect(response.body).toHaveProperty("hash");
expect(response.body).toHaveProperty("nonce");
});
it("should add the new block to the blockchain", async () => {
const data = "Another Test Block";
await request(app).post("/mine").send({ data });
const response = await request(app).get("/blocks");
expect(response.status).toBe(200);
expect(response.body).toBeInstanceOf(Array);
expect(response.body.length).toBeGreaterThan(1);
expect(response.body[response.body.length - 1]).toHaveProperty("data", data);
});
});
Maximizing Copilot's Accuracy
To improve Copilot’s suggestions, you can provide it with more context by attaching multiple file references. This helps generate better results when working on complex applications.
Example:
If you reference both server.js
and server.test.js
, Copilot can:
- Understand existing function structures.
- Suggest more relevant test cases.
- Generate related APIs with improved accuracy.
Time Savings with GitHub Copilot
Using GitHub Copilot, I:
- Created an API in minutes instead of hours.
- Generated test cases instantly without manual effort.
- Added new APIs seamlessly, reducing development time significantly.
Estimated Time Savings:
Task | Without Copilot | With Copilot |
---|---|---|
Writing API code | ~2 hours | ~30 minutes |
Writing test cases | ~1 hour | ~10 minutes |
Expanding functionality | ~1 hour | ~15 minutes |
Total Time Saved | ~4 hours | ~55 minutes |
Here’s the additional content you requested. You can copy and paste it into the appropriate sections of your original blog post.
Insights on GitHub Copilot
The time savings mentioned in this article are based on actual development efforts. Compared to similar previous projects, GitHub Copilot significantly reduced the time required to write and test code.
GitHub Copilot provides more accurate results when you attach relevant files while prompting it in the chat. Providing context helps it understand function definitions, dependencies, and existing logic.
I use GitHub Copilot daily for development, primarily working with React.js, Node.js, and Python. My productivity has increased drastically, allowing me to focus on problem-solving rather than repetitive coding tasks.
I realized the full potential of Copilot when writing test cases for a legacy codebase. It helped me understand the logic of existing code quickly and generated meaningful test cases. As I continued working, its suggestions improved progressively.
If you're a web developer working with React.js, Node.js, and Python, GitHub Copilot will save tons of development time, making your workflow much smoother and more efficient.
Conclusion
GitHub Copilot is a game-changer for developers, reducing coding time and making development more efficient. By integrating Copilot with VS Code, you can accelerate development, improve code quality, and focus on more complex tasks.
🏆 The Future of AI-Assisted Coding
GitHub Copilot isn’t replacing developers—it’s empowering them! 🚀
"AI won’t replace engineers. Engineers who use AI will replace those who don’t."
✅ If you haven’t tried GitHub Copilot yet, install it today and experience the future of AI-assisted coding!
Follow for more updates!
Useful Resources:
- Do not know how to start Machine Learning? Click Here
- Looking for AWS Cert? Click Here
- Looking for Azure Cert? Click Here
- Want to control your AWS Billing? Click Here
- New to Cloud? Click Here
- Stay-tune for Blockchain and copilot
Top comments (13)
I regularly use GitHub copilot paid version, along with Copilot CLI and VSCode Insiders, so that I can play with the cutting edge improvements.
In my experience, AI code assistants like GitHub Copilot, Cursor, Windsurf etc. works pretty well when the context length is small and you know exactly what you are doing.
Which means, if you give it too much code to work with, or if you ask for something you yourself have no idea of, then it starts messing up after a point, without you ever realizing where it all went irreversibly wrong.
Also, there are some other observations I have that didn't change yet from the time of writing the following post: State of generative AI in Software Development: The reality check!
I think you'll find my observations interesting.
Hi Fayaz,
Thanks for sharing your experience! I completely agree, AI code assistants work best with a well-defined context, but when dealing with larger code-bases or unfamiliar territory, things can go off track quickly.
From my experience, I always ask for improvements in small code blocks or functions. For REST APIs, I create a few myself first and then ask Copilot to generate the rest based on the existing code. Providing references to one or two files works well since it doesn’t require Copilot to infer too much.
However, where it struggles is in generating custom business logic or creating entirely new files/modules based on the existing code-base it often lags or produces inaccurate results.
I think we need to use Copilot the way a developer thinks writing one function at a time or iteratively building on existing code.
Appreciate your insights, and I’d love to check out your post on the state of generative AI in software development and let you know my insights.
Regards,
Ram
Thanks!
BTW, wrote a related post just now: dev.to/fm/poll-on-ai-code-generati...
Please check it out if you get time! ♥️
Sure.
If you need to add something specific to one of your current github repos then I think is better to use from the online account while on the github website.
The recommendations of the online copilot target the repos and account information directly and if required, account info is included directly- in the suggestions.
Not sure if the VS Code extension works exactly the same though.
Hi Chrdek,
Good point, You’re right!
The VS Code extension doesn’t offer the same level of awareness as the GitHub website. Using Copilot directly on GitHub might be useful for vulnerability fixes, but creating new code could be more challenging.
repository-wide context, the GitHub website may have an edge. Build this level of intelligence within extensions with untracked file or code-changes could be difficult.
Thanks for highlighting this! It’s definitely an area that could be improved.
Regards,
Ram
Yep, thanks for the confirmation. Was wondering if it was worthwhile to include in my VS Code extensions as well and also meant to confirm this beforehand. So the entire context of github is not used with the full set of info of VS Code, but only for specified recommendations.
Will try it though just to be sure.
It is useful when you need to quickly make for example a pre-made .yaml or terraform file for your project for direct online deployment so you can directly set it up on your cloud account.
Good article, and also good luck with your code.
Thank you Chrdek ! Glad you found my article useful :) . I will keep you posted my upcoming posts on blockchain development and how Copilot helps me write code.
Regards,
Ram
Agreed. One of the challenges I see is this. It allows one to go deep, really deep quickly. That has its own quirks. The deeper we go, the less we are subject matter experts.
Just today writing a VSCode extension, it took me via discovering things I did know like the Output Channel. It introduced me to how it's set up, configured and used as a logging tool. That part was great!
The part that wasn't so great is it didn't work. I reported the same failure at least 30 times and it was never able to get it right. This leaves me to try again tomorrow. However, the progress was stuck for 4 hours trying to get a logging channel going.
I would have never accidentally discovered the output channel. Rather becoming a SME in VSCode plug ins would have been the normal faire. Subject Matter Expertise takes about 1 year. So, I brushed up to things in 4 hours which was still great.
The other issues I have with it are hallucinations, and its current lack of reading in changes before making suggestions. If a person doesn't realize that is happening, they'll lose their mind saying, "I thought I changed that". But here's the catch, even when you set new rules to stop that kind of thing, it seems to forget those rules throughout the session. It's like banging our head against the wall.
Hi JWP,
Thank you for sharing your insights!
You’ve perfectly captured both the power and the quirks of extensions. It’s amazing how it accelerates learning and exploration, but as you pointed out, the hallucinations and lack of context awareness can be frustrating.
Your experience with the VS Code Output Channel is a great example of both sides of the coin.
Hopefully, as the tool evolves, it will become more reliable in handling iterative changes.
Appreciate your thoughtful perspective!
Regards,
Ram
🚀 Exciting Update! 🚀
Hi Devs,
I’ve just published a new blog on setting up your own AI agent using Fetch.ai uAgents. I created the source code with the help of GitHub Copilot, making it easier and faster to build intelligent agents.
If you’re interested in AI-powered automation, check it out here:
🔗 Set Up Your Own AI Agent in Minutes: Clone, Run, Deploy
Read More
Would love to hear your thoughts and feedback! Let me know what you think in the comments.
This keeps it engaging while highlighting Copilot’s role. Let me know if you need any changes!
Regards,
Ram
One question remains, will it collect secret data for large projects?
I see that many code editors already have this type of feature as a default, like Windsurf, Trae, and more.
Hi Nikhil,
That's a great question! I hadn't thought of mentioning about it when I wrote the article, and I appreciate you bringing it up at the right time.
We need to disable telemetry either for the entire editor (VS Code telemetry) or specifically for GitHub Copilot. Attaching both options.
Disable VS code telemetry
Disable GitHub copilot telemetry
Finally restart the editor. Hope this will work
Regards,
Ram