█
LastWrite
  • > Curriculum
  • > Pricing
  • > For Educators
  • > About
  • > Contact
Log InGet Started

Questions, concerns, bug reports, or suggestions? We read every message, write to us at [email protected].

More ways to reach us →
LastWrite

Structured computer science lessons for aspiring developers and security professionals.

[email protected]

(201) 785-7951

Mon–Fri, 9 AM–5 PM EST

Learn

  • Curriculum
  • Pricing

Company

  • About
  • For Educators & Schools
  • Contact Us

Legal

  • Terms of Service
  • Privacy Policy
© 2026 LastWrite. All rights reserved.
Curriculum/Web Development/AI Application: Web Development/GitHub Copilot: AI Pair Programming
40 minIntermediate

GitHub Copilot: AI Pair Programming

After this lesson, you will be able to: Use GitHub Copilot for inline suggestions and Copilot Chat to ask questions about your codebase without leaving VS Code.

Copilot is the AI tool most professional developers use day to day. It autocompletes as you type, generates whole functions from a comment, and answers questions about your codebase in a chat panel. This lesson covers how to install it, use it effectively, and know when to ignore its suggestions.

Prerequisites:AI in Web Development: The New Workflow

Set up Copilot in VS Code

Free for students; free trial otherwise.

  1. 1

    Install VS Code (code.visualstudio.com) if you don't have it

  2. 2

    Sign up for GitHub Copilot, free for students with the GitHub Student Pack

  3. 3

    In VS Code, install the extensions "GitHub Copilot" and "GitHub Copilot Chat"

  4. 4

    Sign in to GitHub from the Accounts icon in VS Code

  5. 5

    Open any code file. Copilot starts suggesting completions in gray text

The two modes, inline and chat

Inline: as you type, Copilot suggests the next few lines in gray. Press Tab to accept, Esc to dismiss. Chat: open the Copilot Chat panel (sidebar) and ask questions in plain English. Use @workspace to refer to your project, /explain to explain selected code, /tests to generate tests for it.

Inline completion
ghost text
  • ·Gray suggested code appears as you type
  • ·Press Tab to accept, Esc to dismiss
Copilot Chat
side panel
  • ·Ask questions about your code
  • ·Have it explain or refactor a function
Two ways Copilot shows up in VS Code: inline as you type, and as a chat panel you ask.

Comment-driven coding

Type a comment describing what you want, then let Copilot generate the function.

tsx
// Validate that the email is a valid format and that the domain is allowed.
// Allowed domains: ['gmail.com', 'school.edu']
// Return { valid: true } or { valid: false, reason: string }
function validateEmail(email) {
// Copilot fills this in for you, read it carefully before accepting
}

ℹ️ Tip. Copilot is best when context is clear

Copilot reads the file you're in, neighboring files, and the chat history. The cleaner your variable names, the better its suggestions. Vague names → vague code. Sometimes typing one comment is faster than typing the function yourself.

Pitfalls, what to watch for

Copilot sometimes invents APIs that don't exist ("hallucination"). It also picks up subtle bugs from training data, e.g., off-by-one errors or missing null checks. When the suggestion looks too convenient ("oh wow it just knows the right library!"), pause and verify. Always test, always review.

Quick Check

What's the difference between Copilot inline suggestions and Copilot Chat?

When would you use one versus the other?

Sign in and purchase access to unlock this lesson.

Sign in to purchase
←Claude Code: AI-Powered Development from the Terminal
Back to AI Application: Web Development
Browser-Based IDEs and AI Coding Agents→