STAT 133
  1. Tools
  2. Code Completion
  • Home
  • Syllabus
  • Office Hours

  • Projects
    • Sampson’s Monks
    • Zero Emission Vehicles
    • Your Life in Data
    • Gerrymandering
    • Build a Package
    • Second Opinion

  • Problem Sets
    • PS 1
    • PS 2
    • PS 3
    • PS 4
    • PS 5
    • PS 6
    • PS 7

  • Tools
    • DataHub
    • Shell
    • R
    • R App
    • Git
    • Positron
    • OpenRouter
    • Code Completion
    • Posit Assistant
  1. Tools
  2. Code Completion

Code Completion

GitHub Copilot logo

GitHub Copilot is a service from GitHub that runs large language models for coding. In Positron it gives you code completion: as you type, a model predicts what comes next and shows it as gray “ghost text” that you can accept or ignore.

This page covers turning Copilot on for your GitHub account, connecting it to Positron, and using completions.

1. Turn on Copilot for your GitHub account

You already have a GitHub account. Copilot comes in two plans:

Plan Cost Limits How to get it
Copilot Free Free About 2,000 completions and 50 chat requests a month Turn it on now
Copilot Pro Free for verified students Unlimited completions; much higher chat limits Apply through GitHub Education

Start with Copilot Free so you can use it today, and apply for GitHub Education at the same time. Approval can take a few days, and once it comes through your account switches to Copilot Pro without any change in Positron.

Copilot Free

  1. Sign in at https://github.com/ and go to https://github.com/settings/copilot (Settings → Copilot).
  2. If Copilot isn’t on yet, click the button to start using Copilot Free.

GitHub Education (Copilot Pro)

  1. Go to https://github.com/education and click Join GitHub Education (or Get benefits), then choose Student.
  2. Add your @berkeley.edu email address to your GitHub account if it isn’t there already, and select it in the application.
  3. Follow the prompts to prove you’re enrolled. GitHub may ask for a photo of a document that shows your name, Berkeley, and a current date, such as a page from CalCentral showing your enrollment.
  4. Submit, and watch your email. After you’re approved, it can take up to a few days for the benefits to arrive. Then go to https://github.com/settings/copilot and claim Copilot Pro if it isn’t on already.

2. Update Positron

The steps below are for Positron 2026.11 or later. To check your version and update, use Positron → Check for Updates… (macOS) or Help → Check for Updates… (Windows).

3. Connect Copilot to Positron

  1. Click the Accounts icon (the person icon near the bottom of the activity bar, on the far left of the window) and choose Configure Language Model Providers. You can also open the Command Palette (⌘ + Shift + P on macOS, Ctrl + Shift + P on Windows) and run Posit Assistant: Configure AI Providers.
  2. The AI Providers screen lists the services Positron can connect to. Find the GitHub Copilot row and click Connect.
  3. Positron says that it wants to sign in using GitHub. Click Allow.
  4. Your web browser opens a GitHub page. Sign in if asked, and click Authorize (or Continue) to let Positron use your account.
  5. When the browser says you’re done, return to Positron. The GitHub Copilot row now shows that it’s connected. You can close the AI Providers screen.

4. Use code completion

Open an R script or a .qmd file and start typing. After a short pause, gray ghost text appears at your cursor: the model’s guess at what comes next.

  • Press Tab to accept the whole suggestion.
  • Press ⌘ + → (macOS) or Ctrl + → (Windows) to accept it one word, or one line, at a time.
  • Press Esc, or just keep typing, to ignore it.

Try it: in a new R script, type a comment that says what you want and press Return.

library(dplyr)

# compute the mean body mass for each species of penguin

A suggestion like penguins |> group_by(species) |> summarize(...) should appear on the next line. The model saw your comment, your library() call, and the rest of the file: everything near the cursor is its context.

5. Turn it off and on

Code completions aren’t for everyone. I find them distracting, so here’s how to turn them off.

  • Click the Copilot icon at the right end of the status bar, the thin strip along the very bottom of the Positron window. Its menu turns completions off or on for the current file type or for all files. If you don’t see a status bar, turn it on with View → Appearance → Status Bar.
  • Run Snooze Inline Suggestions from the Command Palette to pause them for a while, and Cancel Snooze Inline Suggestions to bring them back early.

Troubleshooting

If no ghost text appears:

  • Wait a second after typing. Suggestions don’t appear on every keystroke.
  • Check that GitHub Copilot shows as connected on the AI Providers screen (step 3).
  • If you’re not able to see completion, try signing out of GitHub and then back in again.
  • Check that you haven’t used up Copilot Free’s monthly completions. Your usage is at https://github.com/settings/copilot.
  • Open Settings (⌘ + , or Ctrl + ,), search for inlineSuggest.enabled and ai.enabled, and make sure both are checked.

Tips

  • Good names and comments are context. The more your code says what it’s for, the better the guesses.
  • Copilot sends the code around your cursor to GitHub to make each suggestion. Don’t use it on files that hold passwords or API keys.
 
  • License