Skip to content

GitHub Copilot — The AI That Lives in Your Editor

Set up GitHub Copilot for inline code completions and AI-assisted development in VS Code.

10 min readai-tools, github-copilot, vs-code, code-completion

GitHub Copilot takes a different approach from the other tools in this module. It's not a standalone editor like Cursor. It's not a platform like Bolt or Replit. It's an extension — a plugin that adds AI capabilities to the editor you already use.

Install it in VS Code, start typing, and Copilot suggests what comes next. It's like autocomplete, but instead of suggesting a single word, it suggests entire blocks of code.

How Copilot Works

Copilot runs quietly in the background as you type. It watches what you're writing, looks at the file you're in and other open files, and predicts what you're about to type next. These predictions appear as gray "ghost text" in your editor.

Here's what it looks like in practice. You start typing a function:

function calculateTotal(items) {
  // Calculate the sum of all item prices with tax

Copilot sees your function name and comment, and suggests:

  return items.reduce((sum, item) => {
    const tax = item.price * 0.08;
    return sum + item.price + tax;
  }, 0);
}

Press Tab to accept the suggestion. Press Escape to dismiss it and keep typing your own code.

The key insight: Copilot is predictive, not generative. It's not building an application from scratch. It's predicting the next logical piece of code based on what you've already written. This makes it incredibly fast and surprisingly accurate for line-by-line coding.

Setting Up Copilot

Step 1: Get Access

  1. Go to github.com/features/copilot
  2. Sign up for a plan (free tier available for individual developers, or $19/month for the Individual plan)
  3. You need a GitHub account — create one if you don't have it

Step 2: Install the Extension

  1. Open VS Code (or Cursor — Copilot works in both)
  2. Go to Extensions (Cmd+Shift+X on Mac, Ctrl+Shift+X on Windows)
  3. Search for "GitHub Copilot"
  4. Click Install
  5. Sign in with your GitHub account when prompted

Step 3: Verify It's Working

Create a new JavaScript file and start typing:

// A function that reverses a string
function reverseString(

You should see gray ghost text suggesting the function body. If you see it, Copilot is working.

Copilot's Features

Inline Completions (The Main Feature)

This is what Copilot is known for. As you type, it suggests completions. These range from single lines to entire functions. The quality of suggestions depends heavily on the context — comments, function names, surrounding code.

How to get better suggestions:

  • Write descriptive function names (calculateMonthlyPayment beats calc)
  • Add a comment before writing the function
  • Keep related code in the same file or in open tabs
  • Type the first line of what you want, then pause

Copilot Chat

Beyond inline completions, Copilot has a chat feature (similar to Cursor's). You can:

  • Ask questions about your code: "What does this regex do?"
  • Request explanations: "Explain the authentication flow in this file"
  • Get help with errors: paste an error message and ask for a fix
  • Generate code: "Write a function that validates email addresses"

Open Copilot Chat with Cmd+Shift+I (Mac) or Ctrl+Shift+I (Windows).

Code Review Suggestions

Copilot can review code you've written and suggest improvements. Select a block of code, right-click, and choose "Copilot > Review and Comment." It'll point out potential bugs, performance issues, and style improvements.

Where Copilot Shines

Boilerplate Code

Copilot eliminates the tedium of writing repetitive code. API endpoint handlers, database queries, form validation, test cases — it's seen millions of examples and can generate these patterns almost perfectly.

Pattern Continuation

If you write one item in a pattern, Copilot continues it:

const MONTHS = {
  january: 1,
  february: 2,
  // Copilot will suggest the rest...

Comment-Driven Development

Write a comment describing what you need, and Copilot generates the code:

# Read a CSV file, filter rows where the "status" column is "active",
# and return the results sorted by "created_at" descending

Copilot generates the entire implementation from this comment. This is essentially vibe coding at the function level.

Test Generation

When you create a test file and start writing the first test, Copilot often generates a full suite of tests for the code being tested. It knows the common testing patterns for every framework.

Where Copilot Falls Short

Complex Logic

Copilot predicts based on patterns. When your code requires genuinely novel logic — complex algorithms, unusual business rules, intricate state management — its suggestions are often wrong or generic. This is where tools like Cursor's Composer or Claude Code are stronger.

Multi-File Understanding

Copilot primarily looks at the current file and open tabs. It doesn't have the deep codebase understanding of Cursor's project-wide features or Claude Code's comprehensive file reading. If your change requires understanding how files across your project connect, Copilot won't catch those dependencies.

Blind Trust Trap

Because Copilot's suggestions appear inline and pressing Tab is so easy, there's a real risk of accepting code without reading it. This is the biggest pitfall for vibe coders. The suggestion looks reasonable, you Tab through it, and now you have code in your project that you don't understand and that might have subtle bugs.

The rule: read before you Tab. Even a quick scan is better than blind acceptance.

Copilot vs. Cursor

Since both work in VS Code-style editors, this comparison comes up constantly:

| Feature | GitHub Copilot | Cursor | |---------|---------------|--------| | Inline completions | Excellent | Good | | Multi-file generation | Limited | Excellent (Composer) | | Project understanding | Open tabs only | Full codebase | | Chat quality | Good | Excellent | | System prompts | Limited | .cursorrules | | Price | $19/mo | $20/mo | | Editor | Extension for VS Code | Standalone (based on VS Code) | | Best for | Speeding up line-by-line coding | AI-first development |

The practical answer: If you're primarily writing code yourself and want AI to speed you up, Copilot is excellent. If you want AI to generate large chunks of code and handle multi-file operations, Cursor is better.

Some people use both — Cursor as their editor with Copilot installed as an extension. This gives you Cursor's Composer and chat features alongside Copilot's inline completions.

Tips for Effective Copilot Use

Write comments first. Copilot treats comments as specifications. A well-written comment produces a well-written function. Get in the habit of describing what you want before you start coding.

Name things well. getUserSubscriptionStatus gets better suggestions than check. Descriptive names give Copilot more context to work with.

Open relevant files. Before working on a feature, open the files that are related. Copilot uses open tabs as context. If you're writing a function that needs to match a database schema, open the schema file.

Accept partially. You don't have to take the whole suggestion. Type a few characters of what you actually want, and Copilot will adjust its suggestion. You can also accept word-by-word with Cmd+Right Arrow.

Cycle through alternatives. When you see a suggestion, press Alt+] to see the next alternative. Copilot often has multiple suggestions, and the first one isn't always the best.

Use it for learning. When Copilot suggests something you don't understand, don't just accept it. Ask Copilot Chat "What does this suggestion do?" Understanding the generated code makes you a better coder.

Try this now

  • Write a descriptive comment above a small function and watch how Copilot completes it.
  • Open the schema or helper files Copilot will need before you ask it to help with the feature.
  • Read every suggestion before you accept it, even if it looks obviously right.

Prompt to give your agent

"I'm using GitHub Copilot in VS Code. Help me get better suggestions for this task: [describe task]. Tell me:

  1. what comments or function names I should write first
  2. which related files I should open for context
  3. when Copilot is likely enough and when I should switch to a stronger multi-file tool
  4. what I must review manually before I accept a suggestion"

What you must review yourself

  • Whether your comments and names are specific enough to steer good completions
  • Whether the suggestion actually matches the logic and types in your project
  • Whether the task requires deeper project understanding than Copilot usually has
  • Whether convenience is pushing you toward blind acceptance

Common Mistakes to Avoid

  • Using Copilot like an autopilot. Inline suggestions are easy to accept and easy to misunderstand.
  • Prompting it with vague names and comments. Predictive tools need good local context.
  • Expecting deep multi-file reasoning. Copilot is not optimized for that class of task.
  • Ignoring alternatives. The first suggestion is not automatically the best one.

Key takeaways

  • Copilot is best at accelerating code you are already writing
  • Strong comments and naming conventions improve its suggestions dramatically
  • Reading before you press Tab is the core safety habit
  • Copilot pairs well with stronger project-wide tools instead of replacing them

What's Next

Next up: The Anatomy of a Good Coding Prompt. Structure your prompts for AI coding tools to get better, more predictable results. This builds directly on what you learned here, so carry the same discipline forward: define the constraints first, then use your AI agent to implement against them.