Live training: next batches coming soon. Join the waitlist:Waitlists open:Developer Training →Developer →Copilot Studio Training →Copilot Studio →

How to Add GitHub Copilot to Visual Studio Code (Step by Step)

Two of our SPFx developers asked me the same thing last week: “Can we get that AI autocomplete in VS Code without a big install?” They write TypeScript all day and wanted help with the boring parts.

So here’s how to add GitHub Copilot to Visual Studio Code in about five minutes. Once it’s on, Copilot finishes your code in gray ghost text as you type, and a Chat view explains or changes code when you ask.

In this tutorial, we’ll add GitHub Copilot to Visual Studio Code, accept a real suggestion, and ask Copilot Chat about it. I ran every step on Windows 11 with VS Code 1.144.0, on 11/01/2026.

Here’s what we’re building. Copilot wrote the function on the left, and Chat explains it on the right:

GitHub Copilot Chat in Visual Studio Code explaining the getOpenRequests function that Copilot wrote
  • Sign-in to GitHub from VS Code, which turns on the Copilot features.
  • Inline suggestions that complete a whole function from its name and a comment.
  • Copilot Chat in a side panel that reads the open file as context.

Before You Start

You need a recent VS Code and a GitHub account. If the account has no Copilot plan, signing in enrolls an eligible account in Copilot Free, which comes with a monthly allowance. If your employer gives you Copilot, sign in with that work account. New to VS Code? Set up your SPFx development environment first.

Our sample is one file, service-requests.ts, in C:\SPGuidesDemo\copilot-demo. It holds four Service Desk requests and ends with a comment telling Copilot what we want:

// SPGuides Service Desk - sample data for the GitHub Copilot demo
interface ServiceRequest {
  id: number;
  title: string;
  status: "New" | "In Progress" | "Closed";
  priority: "Low" | "Normal" | "High";
  requester: string;
}

const requests: ServiceRequest[] = [
  { id: 1001, title: "Laptop replacement", status: "New", priority: "High", requester: "Jordan Ellis" },
  { id: 1002, title: "VPN access", status: "In Progress", priority: "Normal", requester: "Maya Brooks" },
  { id: 1003, title: "Mailbox permissions", status: "Closed", priority: "Low", requester: "Chris Patel" },
  { id: 1004, title: "SharePoint site request", status: "New", priority: "Normal", requester: "Taylor Reed" },
];

// Return all requests that are not closed, highest priority first
RequestTitleStatusPriority
1001Laptop replacementNewHigh
1002VPN accessIn ProgressNormal
1003Mailbox permissionsClosedLow
1004SharePoint site requestNewNormal

How to Add the GitHub Copilot Extension to Visual Studio Code

Older guides start with the Extensions view: search for GitHub Copilot and select Install. You can skip that today. GitHub’s docs say the required extensions are installed automatically when you set up Copilot in VS Code, so there’s nothing to download by hand. (Confused about which Copilot this is? See GitHub Copilot vs Microsoft Copilot.)

I checked before signing in. Running code --list-extensions listed no Copilot extension at all, yet the Copilot icon was already in the Status Bar. The sign-in in Step 1 is the real install step.

Step 1: Sign In to GitHub From VS Code

  1. Open VS Code with your project folder. On the Welcome page, the Walkthroughs list includes GitHub Copilot.
  2. Select Sign in to GitHub at the bottom of the page (that’s the route I used).
  3. Or hover the Copilot icon in the Status Bar and select Use AI Features, then pick a sign-in method.
  4. In the browser, authorize Visual Studio Code, then switch back.
VS Code Welcome page with the GitHub Copilot walkthrough and the Sign in to GitHub button

Checkpoint: the Sign in to GitHub button is gone. Mine changed to Try out the new Agents window, which means you’re signed in.

Other ways in: the Accounts menu in the Activity Bar, or the GitHub Copilot: Sign in command. GitHub Enterprise users pick Continue with GHE.com. Copilot works in any project, including our SharePoint Framework tutorials.

Step 2: Type a Function Name Under the Comment

Now we give Copilot something to finish. The comment on line 17 already says what we want, the same way you’d describe a helper in a first SPFx client-side web part.

  1. Open service-requests.ts.
  2. Click line 18, below the comment.
  3. Type function getOpenRequests( and stop typing.
Typing function getOpenRequests on line 18 of service-requests.ts in VS Code

Step 3: Read the Gray Inline Suggestion

After a moment, dimmed gray text appears at the cursor. That’s an inline suggestion, and nothing is in your file yet.

Copilot first offered just : ServiceRequest[] {, then the full block: a filter that drops closed requests and a sort by priority. A small sparkle icon shows in the gutter on line 18.

Gray inline suggestion from GitHub Copilot completing the getOpenRequests function in VS Code

Note: Don’t like it? Press Esc to dismiss it, or hover the ghost text to show a toolbar where you can cycle through alternatives.

Step 4: Accept the Suggestion With Tab

Press Tab. The gray text turns into real code on lines 18-25. To take only part of it, Ctrl+Right Arrow accepts the next word.

Accepted GitHub Copilot suggestion on lines 18 to 25 after pressing Tab in VS Code

Here’s the exact function Copilot wrote, in TypeScript. It’s the same filter-then-sort pattern we use to display SharePoint list items in an SPFx web part:

function getOpenRequests(): ServiceRequest[] {
  return requests
    .filter(request => request.status !== "Closed")
    .sort((a, b) => {
      const priorityOrder = { "High": 1, "Normal": 2, "Low": 3 };
      return priorityOrder[a.priority] - priorityOrder[b.priority];
    });
}

Checkpoint: lines 18-25 are normal code, not gray. On our four requests it returns 1001, 1002 and 1004, as Chat confirms below.

Step 5: Check Your Plan in the Copilot Status Dashboard

Want to see what you’re signed in with? Select the Copilot icon at the bottom right of the Status Bar.

The status dashboard pops up with the plan name, the share of the monthly allowance used, and when it resets. Mine showed a paid plan, 0% used, and Inline Suggestions: Enabled. A Free account shows its own allowance here.

GitHub Copilot status dashboard in VS Code showing credits used and Inline Suggestions enabled

The same menu turns inline suggestions off per language or for all languages, and Snooze pauses them for five minutes at a time.

How to Add GitHub Copilot Chat to Visual Studio Code

Chat came with the same sign-in, so there’s no second setup. Press Ctrl+Alt+I and the Chat view opens on the right. (Building a chatbot for your users instead? That’s a different tool: create a new agent using Copilot Studio.)

  1. Keep service-requests.ts open. The chat input shows it as an attached context chip.
  2. Leave the mode on Agent. The input placeholder reads Describe what to build.
  3. Type # to add more context, such as another file or #codebase.

Test Copilot Chat on the New Function

I asked, “Explain what getOpenRequests does.” The answer is in the screenshot at the top of this post.

Chat explained the filter and the sort, and noted that Array.prototype.sort is stable, so equal priorities keep their order. It listed the result: 1001 Laptop replacement (High), 1002 VPN access (Normal) and 1004 SharePoint site request (Normal).

It added, “Request 1003 is left out because it’s closed,” and suggested moving priorityOrder outside the sort callback, since it’s rebuilt on every comparison. Try it on real web part code too, like a routine to filter SharePoint list items in SPFx.

Turn Copilot Off for One Workspace

Some client repos don’t allow AI tools. The setting chat.disableAIFeatures hides chat and inline suggestions and disables the Copilot extension. Set it in the Settings editor, or add this to the workspace settings.json:

{
  "chat.disableAIFeatures": true
}

Set it at the user level to switch Copilot off everywhere. To change accounts, open the Accounts menu in the Activity Bar, select Sign out, then sign in with the other account.

Troubleshooting

  • No gray text appears. Open the status dashboard and make sure Inline Suggestions is Enabled and not snoozed. You can also run Trigger Inline Suggestion from the Command Palette.
  • Use AI Features isn’t in the hover menu. I didn’t see it either; the Welcome page button or the GitHub Copilot: Sign in command works the same.
  • Copilot stopped mid-month. A Free account used its monthly allowance. The dashboard shows when it resets.
  • Wrong account signed in. Sign out from the Accounts menu and sign in again.

Important: Copilot can write code that looks right and isn’t. Read every suggestion before you accept it.

Where to Take It Next

Use Copilot on a real project next: scaffold a web part and let it draft property pane code or PnPjs calls. If your team is weighing Copilot tools for business users too, our Microsoft 365 Copilot vs Copilot Studio comparison sorts that out.

For hands-on SPFx work with Copilot in VS Code, the SPFx training course walks through full web parts end to end.

A few more SPFx guides that pair well with Copilot:

Frequently Asked Questions

How do I add GitHub Copilot to Visual Studio Code?

Open VS Code, hover the Copilot icon in the Status Bar and select Use AI Features, or select Sign in to GitHub on the Welcome page. Authorize VS Code in the browser and Copilot turns on. Microsoft covers the routes in Set up GitHub Copilot in VS Code.

Do I need to install the GitHub Copilot extension manually?

No. GitHub’s docs say the required extensions are installed automatically when you set up Copilot in VS Code. In our run, no Copilot extension was listed before sign-in, and everything worked after it.

Is GitHub Copilot free in VS Code?

There’s a Copilot Free plan. If your account has no plan, signing in enrolls an eligible account in it, with a monthly allowance of inline suggestions and AI credits. Paid plans add more; GitHub lists them in Plans for GitHub Copilot.

How do I open GitHub Copilot Chat in VS Code?

Press Ctrl+Alt+I to open the Chat view. The open file is attached as context, and you can type # to add files, symbols or your codebase.

How do I turn off GitHub Copilot in VS Code?

Set chat.disableAIFeatures to true in user or workspace settings. To stop only the ghost text, turn off inline suggestions from the Copilot Status Bar menu, or snooze them for five minutes.