# Gemini code assist in the IDE
Gemini Code Assist puts completions, chat, and multi-step agents directly inside VS Code and JetBrains, which means the model reads your actual project instead of the snippet you happened to paste into a chat window. That single difference (full repository context versus a lonely paragraph) is why the IDE assistant changes how you refactor, debug, and ship.
This lesson assumes you already understand context windows and agents conceptually. Here we go deep on the specific surfaces Code Assist exposes, how to drive a real refactor with it, and the precise moments when reaching for the IDE beats the Gemini app.
Gemini Code Assist is a plugin. You install it from the VS Code Marketplace or the JetBrains plugin registry, sign in with a Google account, and it attaches Gemini's coding-tuned models to your editor. The official setup and feature reference lives at cloud.google.com/gemini/docs/codeassist.
It exposes three distinct surfaces, and knowing which one you are in matters:
@-mention files and folders to pull them into context explicitly.There are two tiers. The free Code Assist for individuals has generous limits and is enough for solo work. Standard and Enterprise tiers connect to your Google Cloud project, add admin controls, IP indemnification, and the ability to customize the assistant with your private code via code customization (it indexes your repos so completions match your house patterns). Tier details are at cloud.google.com/gemini/docs/codeassist/overview.
When you paste a function into the Gemini app, you hand the model one fragment with zero surroundings. It cannot see the type defined two files over, the test that pins the behavior, or the helper you already wrote that does half the job. So it guesses, and you spend the next ten minutes correcting imports and signatures.
Inside the IDE, Code Assist resolves that context automatically. When you ask it to change a function, it can see the callers, the types, and the project structure. The result is fewer hallucinated imports and edits that actually compile.
Use the IDE when:
Use the Gemini app or AI Studio when you are exploring an idea with no codebase yet, drafting a throwaway script, or reasoning about architecture before any files exist. The app's strength is open-ended thinking. The IDE's strength is grounded execution.
Here is a small but real example. You have a synchronous Python function that fetches users one at a time, and it is slow. You want it converted to async with concurrent fetches.
Starting code in services/users.py:
import requests
def fetch_users(user_ids):
results = []
for uid in user_ids:
resp = requests.get(f"https://api.example.com/users/{uid}")
resp.raise_for_status()
results.append(resp.json())
return resultsOpen the chat panel and @-mention the file plus its test:
> Refactor @services/users.py to use httpx.AsyncClient and fetch all users concurrently with asyncio.gather. Keep the same return shape. Update @tests/test_users.py to match. Don't change the public function name.
Notice what the prompt does. It names the library, the concurrency primitive, the constraint on the return shape, and the constraint on the name. Code Assist is good, but a vague "make this async" leaves it to invent decisions you will have to undo. Specify the contract; let the model handle the mechanics.
Agent mode returns a diff like this:
import asyncio
import httpx
async def fetch_users(user_ids):
async with httpx.AsyncClient() as client:
tasks = [client.get(f"https://api.example.com/users/{uid}") for uid in user_ids]
responses = await asyncio.gather(*tasks)
results = []
for resp in responses:
resp.raise_for_status()
results.append(resp.json())
return resultsThis is where IDE review earns its keep. The model kept the name, kept the return shape, and moved the raise_for_status checks after gather. You can see the full before/after in the diff viewer and accept it file by file, or reject a hunk and ask for a change in the same chat thread.
Tell the agent: "Run the test suite and fix anything that breaks." It will detect that fetch_users is now a coroutine, find the test that calls it synchronously, and add @pytest.mark.asyncio plus an await. Because it can execute the command and read the failure output, it iterates instead of guessing. That feedback loop is the thing you simply cannot get from the chat app.
Code Assist made one silent decision worth catching: if any single request fails, asyncio.gather raises immediately and the whole batch dies. The original code also failed on the first error, so behavior is preserved, but this is exactly the kind of detail you confirm in the diff. The assistant accelerates the typing; you still own the semantics.
Inline completions feel passive, but you can steer them. The strongest lever is the code you have already written above the cursor. A descriptive function name and a clear docstring produce dramatically better ghost text than a bare def process():.
A practical pattern: write the signature and a one-line docstring, then pause. Code Assist often completes the entire body correctly because the intent is now unambiguous.
def parse_iso_timestamp(value: str) -> datetime:
"""Parse an ISO 8601 string, assuming UTC when no offset is present."""
# completion fills in the body from hereComments work as inline instructions too. Type # convert this list of dicts to a pandas DataFrame and drop null rows on its own line and the next completion will usually do exactly that.
Code Assist respects a few project conventions that meaningfully improve output. You can give the agent persistent instructions so you stop repeating yourself in every prompt. Place a context file at the root of your repo describing standards the assistant should always follow:
# .gemini/styleguide.md is read by Code Assist for code review and chat
rules:
- Prefer httpx over requests for new HTTP code.
- All public functions require type hints and a docstring.
- Use pytest, never unittest, for new tests.
- Raise domain exceptions from errors.py, not bare Exception.With this in place, the refactor above would have chosen httpx and added type hints without you asking. Persistent rules turn the assistant from a generic coder into one that matches your codebase. Check the current config format in the docs, since the exact filename and schemaschemaA schema is the formal blueprint that defines how data is structured, named, typed, and related within a database, file, or message.View full definition → evolve.
The Enterprise code customization feature goes further: it connects to your source repositories so completions are drawn from your private patterns, not just public training data. This is the difference between "a correct async refactor" and "an async refactor that uses your team's exact client wrapper and error types."
Knowledge check
1. According to the lesson, what is the single most important difference that makes the IDE assistant change how you refactor, debug, and ship?
2. In the Code Assist chat panel, how do you explicitly pull specific files or folders into the model's context?
3. Gemini Code Assist attaches Gemini's coding-tuned models to which environments?
4. Select ALL correct answers about the three surfaces Gemini Code Assist exposes.
Sélectionnez toutes les réponses correctes.
5. Select ALL correct answers about the tiers of Gemini Code Assist described in the lesson.
Sélectionnez toutes les réponses correctes.
Code Assist and Gemini CLI share the same underlying agent capability, but they fit different workflows. The CLI lives in your terminal and shines for scripted, headless, or git-centric tasks ("summarize the diff on this branch", "scaffold a new service from this spec"). Code Assist lives in the editor and shines when you are reading and reviewing code visually, hunk by hunk. Many engineers run both: CLI for terminal-driven automation, the IDE plugin for interactive editing.
Both connect outward through extensions and the Model Context Protocol (MCP), the open standard for giving an agent tools and data sources. You can wire Code Assist's agent to an MCP server that, say, queries your issue tracker or your database schemadatabase schemaA schema is the formal blueprint that defines how data is structured, named, typed, and related within a database, file, or message.View full definition →, so the agent reasons over live project context rather than guessing. The pattern is the same one you will see across Gemini CLI and the Agent Development Kit: describe tools once, let the agent call them.
When a refactor outgrows the IDE (you want a scheduled job, a hosted endpoint, or a multi-agent pipelinepipelineAll active sales opportunities across the stages of the sales process, together with their combined potential value and probability of closing.View full definition →), that is the boundary where you graduate to the Gemini APIAPIApplication Programming Interface: a standardised interface that lets applications communicate and exchange data without knowing each other's internal workings.View full definition → via AI Studio or to Vertex AI. The IDE is for building the code; Vertex AI is for running models in production. Keep the two roles distinct in your head and you will reachreachThe number of unique people exposed to your message in a given period. Unlike impressions, reach counts each person once, no matter how often they see it.View full definition → for the right tool faster.
The mistake is treating Code Assist as a faster autocomplete. The higher-leverage pattern is to work in outcomes:
1. State the goal and the constraints in chat, with @-mentioned files.
2. Let agent mode produce a multi-file diff.
3. Review every hunk; reject what is wrong with a follow-up message.
4. Have it run the tests and iterate on failures.
5. Commit yourself, after reading the result.
Steps 3 and 5 are non-negotiable. The assistant compresses the time from intent to working code, but the accountability for what lands in the repo stays with you.