How to Install GitHub Copilot in Visual Studio Code


Every month (ish), my friends and I plunge into a good old hack-and-slash RPG—but despite their enthusiasm, they’re hopelessly forgetful. To help everyone track our past exploits and stay immersed in the story, I’m building a private online journal just for our group. First up, implementing user registration.
User Story
As a visitor, I want to create an account using my email and a password (or via social login) so that I can become a registered user and access personalised features.
Acceptance Criteria
A clear registration form with fields for name, email and password.
Real-time input validation (e.g. email format, password strength).
Automatic email verification upon successful sign-up.
Friendly error messages for duplicate emails or invalid inputs.
Option to authenticate via Microsoft Account for quick social login.
To Speed up Development, I Enabled Copilot in VS Code
What I Used
Visual Studio Code.
My GitHub account with an active Copilot subscription.
Step 1: Sign Up for Copilot
I went to github.com/features/copilot, started my subscription, and authorised Copilot on my account.
Step 2: Install the Extension
In VS Code, I opened the Extensions pane (⇧ ⌘ X on macOS, Ctrl ⇧ X on Windows/Linux), searched for “GitHub Copilot,” and clicked Install on the official extension.
Step 3: Authenticate
Once installation finished, I clicked Sign in to Use Copilot, let my browser handle the GitHub authentication, and confirmed that the “Signed in” badge appeared in the bottom-right of VS Code.
Step 4: Tweaked My Preferences
I opened Settings (⌘ , on macOS or Ctrl , on Windows/Linux), searched for “Copilot,” and adjusted my settings.
Testing Copilot: A Quick Fibonacci Example
To see Copilot in action, I asked it to generate a Python program that returns the first ten numbers of the Fibonacci sequence, with a custom starting value.
Initial Prompt: Create a function that returns the first ten Fibonacci numbers, starting from a user-specified value
First Attempt: The output didn’t match what I had envision.
Refinement: I asked Copilot for adjustment.
def find_fibonacci_starting_from(start_num, count=10):
"""
Find where the number fits in the Fibonacci sequence and return the next count numbers.
If the number is not in the Fibonacci sequence, find the next Fibonacci number higher than it.
"""
# Initialize first two Fibonacci numbers
a, b = 0, 1
fib_sequence = [a, b]
# Generate Fibonacci sequence until we find or exceed the start_num
while b < start_num:
a, b = b, a + b
fib_sequence.append(b)
# Check if the number is in the sequence
if b == start_num:
# Generate additional numbers if needed to reach count
while len(fib_sequence) < fib_sequence.index(start_num) + count:
a, b = b, a + b
fib_sequence.append(b)
# Get the index of the start number in the sequence
start_index = fib_sequence.index(start_num)
return fib_sequence[start_index:start_index + count], None
else:
# Number not in Fibonacci sequence, return the next higher Fibonacci number
return None, b
def main():
try:
start_num = int(input("Enter a number from the Fibonacci sequence: "))
# Find Fibonacci sequence starting from input number
fib_sequence, next_fib = find_fibonacci_starting_from(start_num)
if fib_sequence:
print(f"\nFibonacci sequence (10 numbers) starting from {start_num}:")
print(fib_sequence)
else:
print(f"\n{start_num} is not in the Fibonacci sequence.")
print(f"The next Fibonacci number is {next_fib}.")
except ValueError:
print("Please enter a valid integer.")
if __name__ == "__main__":
main()
Result: Copilot not only produced the sequence correctly but also included error-handling logic I hadn’t expected.
This little test showed me how easily I can iterate on code—just refine the prompt, accept suggestions, and move forward.
What’s Next?
Build the registration form using Copilot’s suggestions for form validation and email workflows.
Prototype the Microsoft login flow, leveraging Copilot to fill in OAuth boilerplate.
Subscribe to my newsletter
Read articles from Stoned Troll directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
