GitHub Copilot: selecting different suggestion

I’ll share a simple trick I was happy to learn only today (after using GitHub Copilot for over a month).

Copilot is so good at guessing what I intend to write that pretty much all the time I accept the first solution it comes up with.

But sometimes it can guess wrong, or it doesn’t have any way to know which of the few reasonable options I intend to write. For example, when I add a new Unit Test, I might want to write a [TestMethod] or [DataTestMethod] with very similar probability.

So if it guesses wrong, do we need to type the code ourselves? It turns out that not necessarily, as we can easily alternate between suggestions! Here’s how:

In my Visual Studio, the default keyboard shortcut is Ctrl+. but it might differ so check what is it for you 🙂 I hope being aware of this feature makes your coding even more productive 🙂

No comments yet, you can leave the first one!

Leave a Comment