Reading Time 4 minutes

I wanted to share my experience using GitHub Copilot with Visual Studio. As a developer who’s always on the lookout for ways to code faster and smarter, I’m constantly trying out different extensions. Over time, I’ve cycled through many tools, but Copilot has been a game-changer for me. The main benefits I’ve found are its ability to auto-complete code and generate Git commit messages. Plus, it has some neat features like code fixing and optimisation that have made my life so much easier. 

Making IntelliSense Even Smarter 

We all love IntelliSense in Visual Studio—it helps with code completion and saves time. But Copilot takes it to another level. 

Copilot doesn’t just complete the line you’re typing; it can predict entire blocks of code based on what it thinks you’re trying to do. It takes context from other classes to build out what you’re working on. I often find myself typing a single letter and waiting for it to auto-populate the rest. It’s effectively removing the need to write boilerplate code. 

I also appreciate that it tries to keep the code in my style. Whether it’s creating switch statements or LINQ queries, Copilot formats them consistently with the rest of the file. This attention to detail keeps my codebase clean and uniform. 

Automatic Git Commit Messages 

Writing Git commit messages used to be a chore for me. My commit history often ended up with vague messages like “Fixing login” or “Removing redundant code.” Now, with Copilot, I can look at the commit history and see what I actually did. 

Admittedly, it sometimes goes a bit too detailed on smaller changes, but I spend about the same amount of time reading and tweaking it as I did writing generic messages before. Time-wise, it’s a wash, but the quality of the commit history is vastly improved. 

The best part is that these detailed commit messages help populate pull request descriptions. I can even use the commit history in my timesheets to show what I did that day. The details can be a bit technical, so I usually ask Copilot to “rewrite this for an end user,” minimising the brainpower I have to spend on administrative tasks. 

Tip: GitHub Copilot for Teams or Enterprise can build pull request messages from multiple Git commits, but the basic version will just use the latest one. I’d love to try the premium version sometime, but the basic edition covers about 95% of my use cases. 

Gen AI features with /doc and /explain 

Some other features that I use, albeit less frequently, are the slash commands like /doc, /explain, and the #referencing capability. These are features that similar products like ChatGPT can handle by copy and pasting your code into the browser (terrible code security), so having them integrated into Visual Studio is a plus.  

In Visual Studio, I can ask Copilot to /doc the code, and it will add descriptions to each method and their inputs. This makes for a nicer, well-documented codebase if that’s the standard you’re aiming for.  

When dealing with complicated code, the /explain command is a handy tool. It explains the code for me, and I can prompt it to reference other code using #. For example: “/explain this code and how it interacts with #ServiceClass.cs” 

This feature helps me understand complex interactions without having to dig through multiple files. 

Generating Unit Tests 

Copilot can create boilerplate unit tests effectively. While I haven’t gotten results as good as with custom OpenAI models or ChatGPT, I’m hopeful this will improve over time. It’s still a time-saver for setting up the initial structure of tests. I have heard from others that certain use cases it builds amazing unit tests, but personally I have found it slightly lacking at anything other than boilerplate tests. 

Fixing and Optimising Code with /Fix and /Optimise 

The /Fix and /Optimise commands are great for quick code improvements. They allow me to call on AI assistance directly from the IDE without having to switch to a browser or worry about sending sensitive code online. While I believe a custom OpenAI solution hosted on your environment can offer better quality for these tasks, Copilot is rapidly improving, and I’m sure it’ll catch up over the next year. 

Enterprise Integration 

Copilot for Enterprise offers a heap of features that look amazing. While I haven’t had the chance to fully explore these, you can do things like linking Copilot to an internal knowledge repository and private repositories. This means it could adhere to your coding standards and help you recreate features from other codebases easily. It also has enhanced pull request and diff analysis features that would be handy for larger teams. 

On smaller projects with only one or two developers, it might not be necessary. However, I can see this being an amazing tool for larger teams and projects where consistency and adherence to standards are crucial. 

Final Thoughts 

Integrating GitHub Copilot into my Visual Studio workflow has significantly boosted my productivity. From smarter IntelliSense to automated Git commit messages, it’s like having a helpful assistant that understands my coding style and helps me focus on what matters most. 

If you’re a developer looking to streamline your coding process, I highly recommend giving Copilot a try. It’s not perfect, especially with features like unit test generation, but it’s continually improving. Plus, the time and mental energy it saves on routine tasks make it a valuable addition to any developer’s toolkit.