⌂ Home
Gemini Code Assist: AI Pair Programming in Your IDE
Code Assist Track
⏰ 35-45 min Module 2 of 12 🔧 Hands-on lab
🔧
Gemini Code Assist Track — G01: Setup & Your First Suggestion Install Gemini Code Assist in VS Code (and optionally JetBrains), sign in, and see your first AI-generated code suggestion appear — all in under 15 minutes.

Setup & Your First Suggestion

In G00 you saw the map. Now we put the tool on your machine. By the end of this module a faded "ghost text" suggestion will appear in your editor and you'll accept it with one keypress.

Before You Start

Checklist
  • A Google account. A personal Gmail account works for the free Individuals tier (active through June 17, 2026 — see G00). If your company gave you a Standard/Enterprise seat, use that work account.
  • VS Code 1.85+ (Lab A) or a JetBrains IDE 2023.2+ such as IntelliJ IDEA or PyCharm (Lab B). Android Studio users: the plugin ships built in — jump to the note at the end of Lab B.
  • Python 3.10+ so the verification snippet actually runs. Check with python --version.
  • An internet connection — suggestions are generated by Gemini models in the cloud, not locally.
Analogy First

Installing Gemini Code Assist is like hiring that brilliant teammate from G00: there's a tiny bit of paperwork before they can start. The "interview" is installing the extension, the "badge photo" is signing in with Google, and the "desk assignment" is granting the extension permission to talk to Google's servers on your behalf. Skip any step and the teammate shows up but can't get past reception — which is exactly what's happening when people complain "I installed it but nothing appears." The whole onboarding takes about five minutes when you do the steps in order.

Lab A: VS Code Setup

Install the extension

Open VS Code. Press Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (macOS) to open the Extensions panel. Search for "Gemini Code Assist" — the publisher must be Google. Click Install.

Prefer the command line? This does the same thing:

powershell / bash
code --install-extension Google.geminicodeassist
Checkpoint A new sparkle/diamond icon (✦) appears in the Activity Bar on the left edge of VS Code. If you see it, the extension is installed.

Sign in with Google

Click the Gemini Code Assist icon in the Activity Bar, then click Sign in with Google. Your browser opens a Google sign-in page. Choose the account you decided on above and click Allow when asked to authorize the extension.

Checkpoint The browser shows a success page and VS Code's Gemini panel now greets you by account name. The status bar (bottom of the window) shows a Gemini indicator without error badges.

Create the lab folder

We'll use one folder for the whole course. Create it and open it in VS Code:

powershell
New-Item -ItemType Directory -Force "$HOME\gca-course\recipe-box"
code "$HOME\gca-course\recipe-box"
bash
mkdir -p ~/gca-course/recipe-box
code ~/gca-course/recipe-box

Your First Suggestion

Technical Definition

Ghost text is the faded, italic inline preview of a suggested completion. It is not yet part of your file — it becomes real code only when you accept it with Tab. Press Esc to dismiss, or just keep typing to ignore it. When several alternatives exist, hover the suggestion to page through them.

Trigger a completion

In your new recipe-box folder, create a file named units.py and type this comment plus the first line of the function — type it, don't paste it, so the model sees you writing:

units.py — type this yourself
# Convert a quantity in grams to ounces, rounded to 2 decimal places.
# Raise a ValueError if grams is negative.
def grams_to_ounces(

Pause after the open parenthesis. Within a second or two, ghost text proposes the rest of the function. Press Tab to accept it.

units.py — what you should see
# Convert a quantity in grams to ounces, rounded to 2 decimal places.
# Raise a ValueError if grams is negative.
def grams_to_ounces(grams: float) -> float:
    if grams < 0:
        raise ValueError("grams must be non-negative")
    return round(grams / 28.349523125, 2)
✦ Ghost text shown faded — press Tab to accept
✓ Accepted. The code is now real and saved with the file.
Press ▶ to preview the ghost text flow

Verify the generated code actually runs

AI suggestions are drafts, not gospel — always run them. Add this to the bottom of units.py and run the file:

units.py — verification harness
if __name__ == "__main__":
    try:
        print(grams_to_ounces(100))   # expected: 3.53
        print(grams_to_ounces(0))     # expected: 0.0 or 0
        print(grams_to_ounces(-5))    # expected: ValueError
    except ValueError as err:
        print(f"Correctly rejected negative input: {err}")
terminal
python units.py
Expected output 3.53, then 0.0, then Correctly rejected negative input: grams must be non-negative (your exact message may differ — the model writes its own wording). If the math or the error handling differs, that's your first real lesson: read what you accept.
What Just Happened?

You wrote a two-line comment describing intent (including an error-handling requirement) and the model produced a complete, typed, validated function. Notice what drove quality: the comment mentioned rounding and the negative-input rule, so the suggestion included both. Vague comment in, vague code out — this becomes a core skill in G02.

Lab B: JetBrains Setup (IntelliJ / PyCharm)

Skip this section if you're staying in VS Code — or do both and decide which home you prefer. The features are nearly identical; the labs in this course call out the differences when they matter.

Install the plugin

Open Settings → Plugins → Marketplace (Ctrl+Alt+S on Windows/Linux, Cmd+, on macOS). Search for "Gemini Code Assist" (publisher: Google), click Install, and restart the IDE when prompted.

Sign in and open the tool window

After restart, a Gemini icon appears in the right-hand tool window strip. Click it, choose Sign in with Google, and complete the browser flow — same as VS Code. Open any Python file and type the grams_to_ounces comment from Lab A to confirm ghost text appears.

VS Code

Chat locationActivity Bar panel
Agent modeToggle in chat box
MCP config~/.gemini/settings.json
Auto-approve"yolo mode" setting

JetBrains IDEs

Chat locationRight tool window
Agent modeAgent tab
MCP configmcp.json in IDE config dir
Auto-approve"Auto-approve changes" checkbox
Android Studio

Android Studio (Narwhal and later) ships Gemini built in — no marketplace install. Open the Gemini tool window, sign in, and you get completion, chat, and agent mode tuned for Android projects. Everything you learn in this course transfers directly.

Standard / Enterprise Setup (Teams)

Analogy First

The free tier is like using a personal library card: you sign up yourself and you're in. A Standard or Enterprise seat is a corporate library card: the company opens an account with the library (a Google Cloud project), buys a block of memberships (license seats), and hands one to each employee (license assignment). The painful failure mode is an employee holding a card the company never activated — you can sign in but every request is rejected. The three steps below are exactly: open the account, buy the seats, hand them out.

Technical Definition

Standard and Enterprise are licensed through a Google Cloud projectThe basic organizational unit in Google Cloud. Billing, APIs, and permissions all attach to a project. You identify one by its globally unique project ID.. An admin must, once per organization:

  1. Enable the Gemini for Google Cloud API (cloudaicompanion.googleapis.com) in the project.
  2. Purchase a Standard or Enterprise subscription in the Gemini admin console and assign license seats to users.
  3. Grant each developer the "Gemini for Google Cloud User" IAM role (roles/cloudaicompanion.user) on that project.

Admins can do all three from the console UI, or script it:

gcloud — admin one-time setup
# 1. Enable the API (replace my-team-project with your project ID)
gcloud services enable cloudaicompanion.googleapis.com --project my-team-project

# 2. Grant a developer the required role
gcloud projects add-iam-policy-binding my-team-project `
  --member="user:dev@example.com" `
  --role="roles/cloudaicompanion.user"

# (License seats are assigned in Console: Gemini admin page -> Subscriptions)

Then each developer does one extra step in the IDE: after signing in, select the licensed Google Cloud project when the extension asks (VS Code: click the project name in the status bar or run the command "Gemini: Select Google Cloud project" from the palette).

Gotcha

"It works at home but not on my work account" is almost always one of: the API isn't enabled on the selected project, the IAM role is missing, or the IDE is pointed at the wrong project (e.g., your personal sandbox instead of the licensed one). Check those three in that order — it resolves the vast majority of cases.

Troubleshooting

  • No ghost text appears. Confirm the file type is a recognized language (e.g., .py, not .txt); check the status bar Gemini icon for an error badge; make sure inline suggestions aren't disabled (editor.inlineSuggest.enabled in VS Code settings); and verify another AI assistant (e.g., Copilot) isn't capturing completions first — run one assistant at a time.
  • Sign-in loop / browser never returns. Corporate proxies and SSO can block the localhost callback. Try signing in from the browser the IDE opened (not a copied URL), and whitelist accounts.google.com.
  • "Quota exceeded" messages. Free-tier daily limits reset every 24h. Teams: confirm the license seat is actually assigned, not just the IAM role.
  • Suggestions are slow. Completions are cloud-generated; check your connection. JetBrains users: disable other completion-heavy plugins for a fair test.
  • Behind a firewall. The extension needs HTTPS access to *.googleapis.com. Ask IT to allow it; there is no offline mode.
What Just Happened?

You installed the extension, signed in, generated and verified your first AI-written function, and (if you're on a team) learned the three-step admin flow that powers licensed seats. The tool is live — from here on, every module is about using it well.

Knowledge Check

1. Ghost text just appeared in your editor. What is it, right now?

Code that has already been added to your file and saved
A preview of a suggestion — it only becomes real code when you accept it (Tab)
A syntax error highlight
A comment generated by the linter

2. Which THREE things must an admin set up for a Standard/Enterprise developer seat to work?

Install Docker, create a VM, open port 443
Enable the Gemini for Google Cloud API, assign a license seat, grant roles/cloudaicompanion.user
Buy a domain, configure DNS, issue certificates
Nothing — any Google account automatically gets Standard features

3. The comment you write before triggering a generation matters because…

Comments are required syntax for completions to trigger
The model reads it as your intent — requirements you state (rounding, error handling) show up in the generated code
Longer comments make responses faster
Comments are stripped before being sent, so they don't matter

4. After accepting a generated function, the recommended next step is to…

Commit immediately — generated code is pre-verified by Google
Delete the comment that produced it
Read it and run it — suggestions are drafts and you own their correctness
Regenerate it at least three times

5. Your work IDE shows "quota exceeded" but your IAM role is correct. The most likely cause is…

Your IDE is out of date
No license seat is assigned to your account (the role alone isn't a license), or the IDE points at an unlicensed project
Gemini models are offline globally
Your GEMINI.md file is too large

Quiz Complete!

Ready for G02: Code Completion & Generation →